Python Code: Simply sending email without any attachment

#Python code for sending email using smtp server for gmail
#gmail security may not allow for mail transfer from unsecured platform
#Use less security option of gmail account for executing this code
#Connect Raspberry pi to internet using Ethernet/Wi-Fi or through USB #tethering

import smtplib

smtpUser=’user_account_id@gmail.com’
smtpPass=’account_password’
toAdd=’other_user_account@domainname.com’
fromAdd=smtpUser
subject=”python email test”
header=’To:’+ toAdd + ‘\n’ + ‘From: ‘ + ‘\n’ + ‘Subject: ‘ + subject
body= “From within a Python script”

print header + ‘\n’ + body

s=smtplib.SMTP(‘smtp.gmail.com’,587)

s.ehlo()
s.starttls()
s.ehlo()

s.login(smtpUser, smtpPass)
s.sendmail(fromAdd, toAdd, header + ‘\n’ + body)

s.quit()

Tested Output