So yesterday I had this bit of code written out and it worked perfectly fine, but today it's not sending e-mails anymore. Can someone explain why?
import smtplib
SERVER = 'owa.server.com'
FROM = '[email protected]'
TO = ['[email protected]', '[email protected]']
name = 'Mr. Man'
SUBJECT = 'Recent Information for: %s' % (name)
TEXT = "Dear " +name+ ",\n\nHello.\n\nSincerely,\nOur Guys Here"
message = """From: %s\r\nTo: %s\r\nSubject: %s\r\n\
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
server = smtplib.SMTP(SERVER, 587)
server.ehlo()
server.starttls()
server.ehlo
server.login('[email protected]', 'password')
server.sendmail(FROM, TO, message)
server.quit()
This code is a working snippet. I wasn't getting the e-mails in my personal gmail account because gmail was sending it to the spam folder. I checked to see if it works at my office account, and it did just fine.