#!/usr/bin/python3 import smtplib, ssl class simplemail: def __init__(self, subject, body, sendto = [], user='stagl.mike@gmail.com', password='cherokee2'): self.subject = subject self.body = body self.sendto = sendto self.user = user self.password = password def sendmail(self): email_text = """\ From: %s To: %s Subject: %s %s """ % (self.user, self.sendto, self.subject, self.body) try: server_ssl = smtplib.SMTP_SSL('smtp.gmail.com', 465) server_ssl.ehlo() server_ssl.login(self.user, self.password) server_ssl.sendmail(self.user, self.sendto, email_text) server_ssl.close() except Exception as e: print('Something went wrong...', e) #myemail = simplemail('Test to multiple addrrsses', 'This is a test to two people.', ['stagl.mike@gmail.com', 'M_Stagl@hotmail.com']) #myemail.sendmail()