help with sending mail in Program

Tim Williams listserver at tdw.net
Thu Jun 9 12:46:14 EDT 2005


----- Original Message ----- 
From: "Ivan Shevanski" <darkpaladin79 at hotmail.com>
To: <python-list at python.org>
Cc: <listserver at tdw.net>
Sent: Thursday, June 09, 2005 5:33 PM
Subject: Re: help with sending mail in Program


>
> >
> >#!/usr/local/bin/python
> >
> >''' Send mail to me '''
> >
> >from smtplib import SMTP
> >
> >def sendToMe(subject, body):
> >     me = '"Ivan Shevanski" <mcskittles117 at hotmail.com>'
> >     send(me, me, subject, body)
> >
> >
> >def send(frm, to, subject, body):
> >     s = SMTP()
> >#///On or off for test\\\   #s.set_debuglevel(1)
> >     s.connect('mail.hotmail.com',)
> >     s.ehlo('69.137.27.32') # 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.sendmail(frm, [to], msg)
> >
> >     s.quit()
> >
> >
> >if __name__ == '__main__':
> >     sendToMe('test', 'test')
> >
> >
> >It says it sends it but I get nothing in my inbox or anywhere! This is
> >really frustrating me.
> >
> >_________________________________________________________________
> >
> >[tim williams]>   No it definitely works,  but Hotmail will blackhole
your
> >constructed email as it is obviously fake.  It has no headers,  dates,
> >msg-id etc.
> >
> >[tim williams]>   View the source of a real email in your mail client,
> >then
> >cut & paste the whole thing  into your message variable like this
> >
> >    msg = ''' <msg source here> '''
> >
> >[tim williams]>  you should remove the  " % (frm, subject, to, body) " at
> >the end of the msg string
> >
> >[tim williams]> for correctness, you also need an  "  s.rset()  " in
> >between
> >each  " s.sendmail "   (but the script does work in its current form)
> >
> >[tim williams]>  HTH  :)
> >
> >
> Im good with everything except viewing the source. . .Do you mean the html
> source? Because I use hotmail, and not outlook or thunderbird or something
> like that.  Sorry, i'm a noob.

Supplied a text version of an email to Ivan off-list :)






More information about the Python-list mailing list