help with sending mail in Program
Ivan Shevanski
darkpaladin79 at hotmail.com
Thu Jun 9 11:28:49 EDT 2005
> >>#!/usr/local/bin/python
> >>
> >>''' Send mail to me '''
> >>
> >
> >>from smtplib import SMTP
> >
> >>def sendToMe(subject, body):
> >> me = '"Kent Johnson" <me at mycompany.com>'
> >> 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.sendmail(frm, [to], msg)
> >
> >
> >> s.quit()
> >>
> >>
> >>if __name__ == '__main__':
> >> sendToMe('Testing', 'This is a test')
---
I think this seems like it would work, but I still can't seem to get it to
work. I turned on the debugging and everything seemed alright. I'll post
how I modified it (I probally made a simple mistake). Can someone help
here?
#!/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.
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
More information about the Python-list
mailing list