Ivan Shevanski wrote:
> Could someone send me a good tutorial for sending mail then? The one I 
> found is not what I'm looking for.  Also please dont send me the stmp 
> definition cause i've looked at that enough.

Here is a module I use to send mail to myself using smtplib:

#!/usr/local/bin/python

''' Send mail to me '''

from smtplib import SMTP


def sendToMe(subject, body):
    me = '"Kent Johnson" <[EMAIL PROTECTED]>'
    send(me, me, subject, body)
    
    
def send(frm, to, subject, body):
    s = SMTP()
#    s.set_debuglevel(1)
    s.connect('mail.mycompany.com')
    s.ehlo('10.0.3.160') # IP address of my computer, I don't remember why I 
needed this
    
    msg = '''From: %s
Subject: %s
To: %s

%s
''' % (frm, subject, to, body)

    s.sendmail(frm, to, msg)
    s.quit()
    

if __name__ == '__main__':
    
    sendToMe('Testing', 'This is a test')
    
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to