Send email using Python script
Useful Python script to send an email.
#!/usr/bin/python
import smtplib
host = 'smtpserver.example.com'
sender = 'sender@example.com'
recipients = ['recipient@example.com']
message = """From: <sender@example.com>
To: <recipient@example.com>
MIME-Version: 1.0
Content-type: text/html
Subject: IGNORE test message subject
IGNORE test message body
Some additional content
"""
try:
smtpObj = smtplib.SMTP(host)
smtpObj.sendmail(sender, recipients, message)
print "E-mail sent successfully"
except SMTPException:
print "Error: unable to send email"