mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 19:42:37 +02:00
SMTP_LOGIN can be set to "", meaning that the smtp server does not want authentication (#103)
Co-authored-by: Emmanuel <emmanuel.courcelle@zaclys.net>
This commit is contained in:
parent
79d4e22601
commit
78c501da98
1 changed files with 17 additions and 6 deletions
|
@ -18,16 +18,27 @@ def send(to, subject, body, html=None, copy=None, attachments=None, mail_from=No
|
||||||
body = body.replace("https", "http")
|
body = body.replace("https", "http")
|
||||||
return print("Sending email", str(body.encode('utf-8')), flush=True)
|
return print("Sending email", str(body.encode('utf-8')), flush=True)
|
||||||
|
|
||||||
message.send(
|
# if no SMTP_LOGIN specified, don't create user and password fields, as the smtp server don't want them !
|
||||||
to=to,
|
if config.SMTP_LOGIN=="":
|
||||||
mail_from=mail_from,
|
smtp={
|
||||||
|
"host": config.SMTP_HOST,
|
||||||
|
"port": "25",
|
||||||
|
"ssl": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
else:
|
||||||
smtp={
|
smtp={
|
||||||
"host": config.SMTP_HOST,
|
"host": config.SMTP_HOST,
|
||||||
"user": config.SMTP_LOGIN,
|
"user": config.SMTP_LOGIN,
|
||||||
"password": config.SMTP_PASSWORD,
|
"password": config.SMTP_PASSWORD,
|
||||||
"port": "465",
|
"port": "25",
|
||||||
"ssl": True,
|
"ssl": False,
|
||||||
},
|
}
|
||||||
|
|
||||||
|
message.send(
|
||||||
|
to=to,
|
||||||
|
mail_from=mail_from,
|
||||||
|
smtp=smtp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue