from email.mime.text import MIMEText
from smtplib import SMTP_SSL
def main():
sender = '[email protected]'
receiver = ['[email protected]']
message = MIMEText('Send an email via Python3')
message['From'] = sender
message['To'] = ', '.join(receiver)
message['Subject'] = 'Email Demo'
server = SMTP_SSL('smtp.yandex.com.tr', 465)
server.login(sender, 'xxx')
server.sendmail(sender, receiver, message.as_string())
print('Complete')
server.quit()
if __name__ == '__main__':
main()
from email.mime.text import MIMEText
from email.header import Header
from smtplib import SMTP_SSL
def main():
sender = '[email protected]'
receiver = ['[email protected]']
message = MIMEText('Send an email via Python3', 'plain')
message['From'] = Header(sender)
message['To'] = Header(', '.join(receiver))
message['Subject'] = Header('Email Demo')
smtper = SMTP_SSL('smtp.yandex.com.tr', 465)
smtper.login(sender, 'xxx')
smtper.sendmail(sender, receiver, message.as_string())
print('Complete')
smtper.quit()
if __name__ == '__main__':
main()