Here is another code example I just got working. It uses an Arduino sketch that makes a system call to a python script to send email using gmail account.
1) Create python script (email.py). Change your email account and password, etc of course...
import smtplib
fromaddr = 'myemail@gmail.com'
toaddrs = 'toemail@gmail.com'
msg = "\r\n".join([
"From: myemail@gmail.com",
"To: toemail@gmail.com",
"Subject: Alert!",
"",
"Something happened"
])
username = 'myemail@gmail.com'
password = 'mypassword'
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
2) In your arduino sketch, call this below and update the path if you store it elsewhere
system("python /media/realroot/email.py");