mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 11:32:38 +02:00
Fix email sending
This commit is contained in:
parent
3c39221a2d
commit
cfd9543d92
1 changed files with 4 additions and 1 deletions
|
@ -10,6 +10,9 @@ from . import config
|
|||
|
||||
|
||||
def send(to, subject, body, html=None, copy=None, attachments=None):
|
||||
if not attachments:
|
||||
attachments = []
|
||||
|
||||
msg = MIMEMultipart()
|
||||
msg.attach(MIMEText(body, "plain"))
|
||||
if html:
|
||||
|
@ -28,7 +31,7 @@ def send(to, subject, body, html=None, copy=None, attachments=None):
|
|||
encoders.encode_base64(part)
|
||||
msg.attach(part)
|
||||
if not config.SEND_EMAILS:
|
||||
return print("Sending email", str(msg))
|
||||
return print("Sending email", str(body))
|
||||
try:
|
||||
server = smtplib.SMTP_SSL(config.SMTP_HOST)
|
||||
server.login(config.SMTP_LOGIN, config.SMTP_PASSWORD)
|
||||
|
|
Loading…
Reference in a new issue