Using smtplib

maxm maxm at normik.dk
Mon Mar 13 03:50:59 EST 2000


######################################################################
## How do I send an e-mail

import smtplib

def mail(From='unknown', To='', Subject='', Body=''):
    server = smtplib.SMTP('mail.normik.dk')
    #server.set_debuglevel(1)
    msg = ''
    msg = msg + "From: %s\n" % From
    msg = msg + "To: %s\n" % To
    msg = msg + "Subject: %s\n" % Subject
    msg = msg + "\n"
    msg = msg + Body
    server.sendmail(From, To, msg)
    server.quit()

mail('some at whe.com','other at otherwhere.com','subject is suspect',
     'And here is the actual message')




-ly y'rs

Max M

------------------------------------------------------------------------
Max M Rasmussen,   New Media Director    http://www.normik.dk   Denmark
e-mail  mailto:maxm at normik.dk    private mailto:maxmcorp at worldonline.dk

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Pieter Claerhout
> Sent: 10. marts 2000 16:58
> To: python-list at python.org
> Subject: Using smtplib
> 
> 
> Hello,
> 
> does anyone has an example on how to send an email using the
> smtplib? I'm able to send an email, but I can't figure out how to
> fill in the from, subject and to fields.
> 
> Thanks,
> 
> 
> Pieter
> PClaerhout at creo.be
> http://chill.webhostme.com/
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 





More information about the Python-list mailing list