Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@
from .email import parse_email_recipients, send_smtp_email


_GOOGLE_VOICE_SMTP_HOST = "smtp.gmail.com"
_GOOGLE_VOICE_SMTP_PORT = 465
_GOOGLE_VOICE_SMTP_STARTTLS = False
_GOOGLE_VOICE_SMTP_SSL = True


@dataclass(frozen=True)
class StrategyPluginGoogleVoiceSettings:
gateway_recipients: tuple[str, ...] = ()
gmail_user: str | None = None
gmail_app_password: str | None = field(default=None, repr=False)
smtp_host: str = "smtp.gmail.com"
smtp_port: int = 465
use_starttls: bool = False
use_ssl: bool = True
timeout: float = 10.0

@classmethod
Expand Down Expand Up @@ -276,14 +278,14 @@ def _send_message(
sent = send_notification(
subject=message.subject,
body=message.body,
smtp_host=settings.smtp_host,
smtp_port=settings.smtp_port,
smtp_host=_GOOGLE_VOICE_SMTP_HOST,
smtp_port=_GOOGLE_VOICE_SMTP_PORT,
sender=settings.gmail_user,
recipients=settings.gateway_recipients,
username=settings.gmail_user,
password=settings.gmail_app_password,
use_starttls=settings.use_starttls,
use_ssl=settings.use_ssl,
use_starttls=_GOOGLE_VOICE_SMTP_STARTTLS,
use_ssl=_GOOGLE_VOICE_SMTP_SSL,
timeout=settings.timeout,
)
except Exception as exc:
Expand Down
4 changes: 0 additions & 4 deletions tests/test_google_voice_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,4 @@ def test_google_voice_settings_reads_google_voice_gmail_names_only():
assert settings.gmail_user == "sender@gmail.com"
assert settings.gateway_recipients == ("gateway@txt.voice.google.com",)
assert settings.gmail_app_password == "app-password"
assert settings.smtp_host == "smtp.gmail.com"
assert settings.smtp_port == 465
assert settings.use_ssl is True
assert settings.use_starttls is False
assert settings.missing_fields() == ()