[Tutor] sender name in smtplib
George Wahid
geoterium at gmail.com
Tue Apr 14 00:55:57 CEST 2009
I want to send an email from a google mail account so that the sender
name will be 'User Name' instead of 'username at gmail.com' in the inbox.
this is the code I use: (I'm using python 2.5)
>>>import smtplib
>>>g=smtplib.SMTP('smtp.googlemail.com')
>>>g.ehlo();g.starttls();g.ehlo()
>>>g.login('username at gmail.com','somepassword')
>>>g.sendmail('User Name','username at gmail.com','From: User Name\r\nTo: username at gmail.com\r\nSubject: how r u ?\r\nfoobar')
{}
>>>g.quit()
but this doesn't work, what should I do ?
More information about the Tutor
mailing list