Skip to content

config: add optional CERT_BUNDLE argument #232

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

Open
wants to merge 2 commits 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
5 changes: 3 additions & 2 deletions fastapi_mail/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from aiosmtplib.api import DEFAULT_TIMEOUT
from jinja2 import Environment, FileSystemLoader
from pydantic import DirectoryPath, EmailStr, SecretStr, conint
from pydantic import FilePath, DirectoryPath, EmailStr, conint
from pydantic_settings import BaseSettings as Settings


Expand All @@ -21,7 +21,8 @@ class ConnectionConfig(Settings):
USE_CREDENTIALS: bool = True
VALIDATE_CERTS: bool = True
TIMEOUT: int = DEFAULT_TIMEOUT
LOCAL_HOSTNAME: Optional[str] = None
LOCAL_HOSTNAME: Optional[str] = None
CERT_BUNDLE: Optional[FilePath] = 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 @@ -40,6 +40,7 @@ async def _configure_connection(self) -> None:
start_tls=self.settings.MAIL_STARTTLS,
validate_certs=self.settings.VALIDATE_CERTS,
local_hostname=self.settings.LOCAL_HOSTNAME,
cert_bundle=self.settings.CERT_BUNDLE,
)

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