commit
637df2c3b3
@ -131,9 +131,11 @@ class EmailService:
|
|||||||
with self.smtp(
|
with self.smtp(
|
||||||
self.host, self.port, **connection_params # type: ignore
|
self.host, self.port, **connection_params # type: ignore
|
||||||
) as smtp:
|
) as smtp:
|
||||||
|
if self.use_tls:
|
||||||
|
smtp.ehlo()
|
||||||
|
smtp.starttls(context=context)
|
||||||
|
smtp.ehlo()
|
||||||
if self.username and self.password:
|
if self.username and self.password:
|
||||||
smtp.login(self.username, self.password) # type: ignore
|
smtp.login(self.username, self.password) # type: ignore
|
||||||
if self.use_tls:
|
|
||||||
smtp.starttls(context=context)
|
|
||||||
smtp.sendmail(self.sender_email, recipient, message.as_string())
|
smtp.sendmail(self.sender_email, recipient, message.as_string())
|
||||||
smtp.quit()
|
smtp.quit()
|
||||||
|
Loading…
Reference in New Issue
Block a user