SMTP – Simple Mail Transfer Protocol is used for sending e-mail and routing e-mail between mail servers.
There is a module in python called stmplib which defines an SMTP client session object.
Here is the example
#!/usr/bin/python import smtplib client = smtplib.SMTP('smtp.gmail.com', 587) sender='your mail id' password ='your mail password' recipient ='recipient mail id ' subject ='subject of your mail' body ="<h1>Testing </h1><p>sample mail testing, using python SMTP</p>" headers = ["From: "+sender, "Subject:"+subject, "To:"+recipient, "MIME-Version:1.0", "Content-Type: text/html"] headers = "\r\n".join(headers) client.ehlo() client.starttls() client.ehlo client.login(sender, password) client.sendmail(sender, recipient, headers+"\r\n\r\n"+body) client.quit()