File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ in authorization headers that will be checked by the [Authorization plugin](http
3232| EMAILS_SMTP_SERVER_HOSTNAME | - | The hostname of the SMTP Server |
3333| EMAILS_SMTP_SERVER_PORT | - | The port of the SMTP Server |
3434| EMAILS_SMTP_SERVER_USES_TLS | true | Weither SMTP Server requires TLS |
35+ | EMAILS_SMTP_SERVER_TIMEOUT | 10 | The timeout, in seconds, to use to connect to the SMTP Server |
3536| EMAILS_SMTP_SERVER_USER_NAME | - | The username used to connect to the SMTP Server |
3637| EMAILS_SMTP_SERVER_PWD | - | The password used to connect to the SMTP Server |
3738| EMAILS_SENDER_ADDRESS | - | The email address that is used to send the email from |
Original file line number Diff line number Diff line change 9696 smtp_password = get_secret_or_die ("EMAILS_SMTP_SERVER_PWD" )
9797 smtp_hostname = get_secret_or_die ("EMAILS_SMTP_SERVER_HOSTNAME" )
9898 smtp_port = int (get_secret_or_die ("EMAILS_SMTP_SERVER_PORT" ))
99- smtp_enable_ssl = get_secret_or_die ("EMAILS_SMTP_SERVER_USES_TLS" ) != 'false'
99+ smtp_enable_tls = get_secret_or_die ("EMAILS_SMTP_SERVER_USES_TLS" ) != 'false'
100+ smtp_timeout = float (os .environ .get ("EMAILS_SMTP_SERVER_TIMEOUT" , "10" ))
100101
101102else :
102103 logging .warning ("EMAIL support is disabled" )
@@ -345,8 +346,8 @@ def send_email(request: SendEmailRequest):
345346
346347 # Send the email
347348 try :
348- with smtplib .SMTP (smtp_hostname , smtp_port ) as server :
349- if smtp_enable_ssl :
349+ with smtplib .SMTP (smtp_hostname , smtp_port , timeout = smtp_timeout ) as server :
350+ if smtp_enable_tls :
350351 server .starttls ()
351352 server .login (smtp_login , smtp_password )
352353 server .sendmail (email_sender , split_emails (request .destination_email ), message .as_string ())
You can’t perform that action at this time.
0 commit comments