Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python3 send mail


import smtplib

sender = 'company@website.com'
receivers = ['user@example.com']

message = """From: From Person <company@website.com>
To: To Person <user@example.com>
Subject: SMTP e-mail test

This is a test e-mail message.
"""

try:
   smtpObj = smtplib.SMTP('localhost')
   smtpObj.sendmail(sender, receivers, message)         
   print "Successfully sent email"
except SMTPException:
   print "Error: unable to send email"
Source by fedingo.com #
 
PREVIOUS NEXT
Tagged: #send #mail
ADD COMMENT
Topic
Name
5+9 =