Commit 51abae98 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

reply-to implemented + no auth implemented

parent d7309b42
......@@ -2,6 +2,7 @@ ENCODING = "utf-8"
SUBJECT = "Test subject"
FROM = "email@uni.lu"
REPLY_TO = "email@lih.lu"
LOGIN = "login"
PASSWORD = "password"
......
......@@ -8,7 +8,7 @@ import traceback
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from config import FROM, RECIPIENTS, SUBJECT, TXT_TEMPLATE, LOGIN, PASSWORD, HOST, PORT, SSL, TLS, HTML_TEMPLATE
from config import FROM, RECIPIENTS, SUBJECT, TXT_TEMPLATE, LOGIN, PASSWORD, HOST, PORT, SSL, TLS, HTML_TEMPLATE, ENCODING, REPLY_TO
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)
......@@ -56,6 +56,8 @@ with open(RECIPIENTS) as csv_file:
message["Subject"] = SUBJECT
message["From"] = FROM
message["To"] = recipient
message['reply-to'] = REPLY_TO
message.attach(MIMEText(text_content, "plain", ENCODING))
......@@ -77,7 +79,8 @@ with open(RECIPIENTS) as csv_file:
with smtplib.SMTP(HOST, PORT) as server:
if TLS:
server.starttls() # Secure the connection
server.login(LOGIN, PASSWORD)
if PASSWORD!='':
server.login(LOGIN, PASSWORD)
server.sendmail(
FROM, [recipient, FROM], message.as_string()
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment