[Tutor] improt email, strange from field

Kent Johnson kent_johnson at skillsoft.com
Thu Aug 19 17:21:21 CEST 2004

If you use '"Imperial Data Services" <info at imperialws.com>' as the value 
for both email['From'] and the first argument to sendmail I think it will 
do what you want.


At 07:41 AM 8/19/2004 -0700, Chad Crabtree wrote:
>When I send emails from my cgi script I try to set the from field to
>business name however it says it's from
>"Imperial Data Services"@server-14.mcc-sys.com even though that is
>the email address that sent it.
>What I would like instead is something either 'Just The Name'  like
>I receive personal emails and it shows the name of the person.  Or
>perhaps the email I cent it from.
>Here's the pertinent code
>   email=MIMEText(message)
>   email['Subject']='%s thought you might like this!' %fromname
>   email['From']='"Imperial Data Services"'
>   email['To']=toaddr
>   s = smtplib.SMTP('smtp.imperialws.com')
>   #s.set_debuglevel(1)
>   s.login('info at imperialws.com',passwd)
>   s.sendmail('info at imperialws.com',toaddr, email.as_string())
>   s.close()
>Any help would be greatly appreciated.
>Do you Yahoo!?
>Win 1 of 4,000 free domain names from Yahoo! Enter now.
>Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list