Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add local hostname setting #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class has following attributes
- SUPPRESS_SEND: To mock sending out mail, defaults 0.
- USE_CREDENTIALS: Defaults to `True`. However it enables users to choose whether or not to login to their SMTP server.
- VALIDATE_CERTS: Defaults to `True`. It enables to choose whether to verify the mail server's certificate
- LOCAL_HOSTNAME: It enables to set the hostname of the local machine, which is used to connect to the SMTP server.


### ```MessageSchema``` class
Expand Down
1 change: 1 addition & 0 deletions fastapi_mail/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ConnectionConfig(Settings):
USE_CREDENTIALS: bool = True
VALIDATE_CERTS: bool = True
TIMEOUT: int = DEFAULT_TIMEOUT
LOCAL_HOSTNAME: Optional[str] = None

def template_engine(self) -> Environment:
"""
Expand Down
1 change: 1 addition & 0 deletions fastapi_mail/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async def _configure_connection(self) -> None:
use_tls=self.settings.MAIL_SSL_TLS,
start_tls=self.settings.MAIL_STARTTLS,
validate_certs=self.settings.VALIDATE_CERTS,
local_hostname=self.settings.LOCAL_HOSTNAME,
)

if not self.settings.SUPPRESS_SEND: # for test environ
Expand Down