bad python modules

SNYDER, BARRON F. (AIT) BARRON.F.SNYDER at msg.ameritech.com
Mon Nov 13 16:04:12 EST 2000


sp00fD wrote:

>   ...
>
>The database modules also seem lacking.  Sending mail using the smtp
>module leaves an empty subject line and occassional missing characters
>or extra spaces, whereas in perl, the available mailers work
>perfectly.  Is there a reason for this, or an effort to change it?
>With ActiveState in the picture, can we expect more robust replacements
>soon?
>
>   ...

Though I'm still new to Python, I've had no trouble with the smtplib module.
I use code like the following (which I read about somewhere, probably in
this forum, thanks!) and have been sending quite a bit of mail with all
subject lines intact and no missing characters. (Although I would prefer a
separate subject property rather than lumping it in with the message. The
word "Subject:" gets stripped out automagically, though, so it works fine.)

def mailmsg():
    import smtplib

    msg = "Subject: Dead Parrot\n\n"
    msg = msg + "It's not dead, it's sleeping."
               
    mailfrom = "me at somewhere.com"
    mailto = "you at somewhereelse.com"
    host = "mail.bigserver.com" 			# SMPT mail host

    server = smtplib.SMTP(host)
    server.sendmail(mailfrom, [mailto], msg)
    server.quit()




More information about the Python-list mailing list