Send email in python like php

I noticed that php just has one quick function for sending emails, and I am wondering if I can do this in Python. I know that Python has an email module, but I understand that I need to use an SMTP server to use it, while PHP can use sendmail.

I would rather use Python 3, and any help on this would be greatly appreciated.

+5
source share
1 answer

this is a complete tutorial for sending email in python .. it looks like they also have a sendmail function .. look at

try:
   smtpObj = smtplib.SMTP('localhost')
   smtpObj.sendmail(sender, receivers, message)         
   print "Successfully sent email"
except SMTPException:
   print "Error: unable to send email"
+8
source

All Articles