SMTP-сервер Python отправлять электронную почту с HTML - PullRequest
0 голосов
/ 25 сентября 2019

У меня есть очень простой код для отправки через библиотеку smtplib из Python (2.7)

import smtplib
from email.MIMEText import MIMEText

def ConfigureEmail(to, subject, content):
    sender = 'lehavdeel'
    receivers = [r.strip() for r in to.split(',')]
    message = 'To: %s\nSubject: %s\n\n%s' % (', '.join(receivers), subject, content)
    try:
        smtpObj = smtplib.SMTP('dotvmail06.dot.nycnet')
        smtpObj.sendmail(sender, receivers, message)
    except Exception as e:
        print(e)


TO = "noury" # must be a list

SUBJECT = "This subject is heaps of fun!"

msg = MIMEText('<html><body><h1>Hello World</h1>' +
'<p>this is hello world from <a href="http://www.python.org">Python</a>...</p>' +
'</body></html>', 'html', 'utf-8')

ConfigureEmail(FROM,SUBJECT,msg)

отправка электронной почты, но это вывод

enter image description here

...