From = "name@from.org" To = ["name@to.com"] Date = time.ctime(time.time()) Subject = "New message." Text = "Message Text" #Format mail message mMessage = ('From: %snTo: %snDate: %snSubject: %sn%sn' % (From, To, Date, Subject, Text))
print 'Connecting to Server' s = smtplib.SMTP('mail.sfcn.org')
rCode = s.sendmail(From, To, mMessage) s.quit()
if rCode: print 'Error Sending Message' else: print 'Message Sent Successfully'
Related Scripts with Example Source Code in same category :