[HCoop-Help] How to send mail via a python script?
Alexandre Santos
ochipepe at hcoop.net
Fri Dec 18 15:30:36 EST 2009
I would like to run a python script via a cron job that sends me a mail
I tried this from the mire.hcoop.net console:
>>> import smtplib
>>> server=smtplib.SMTP('mail.hcoop.net')
>>> server.set_debuglevel(1)
>>> server.sendmail('From: ochipepe at hcoop.net\r\n','To: ochipepe at hcoop.net\r\n\r\n','This is a trial')
send: 'mail FROM:<ochipepe at hcoop.net> size=15\r\n'
reply: '250 OK\r\n'
reply: retcode (250); Msg: OK
send: 'rcpt TO:<ochipepe at hcoop.net>\r\n'
reply: '250 Accepted\r\n'
reply: retcode (250); Msg: Accepted
send: 'data\r\n'
reply: '354 Enter message, ending with "." on a line by itself\r\n'
reply: retcode (354); Msg: Enter message, ending with "." on a line by itself
data: (354, 'Enter message, ending with "." on a line by itself')
send: 'This is a trial\r\n.\r\n'
reply: '250 OK id=1NLaj5-0002hx-RS\r\n'
reply: retcode (250); Msg: OK id=1NLaj5-0002hx-RS
data: (250, 'OK id=1NLaj5-0002hx-RS')
>>> server.sendmail('From: myUserName at hcoop.net\r\n','To: myUserName at hcoop.net\r\n\r\n','This is a trial.\r\n.\r\n')
send: 'mail FROM:<myUserName at hcoop.net> size=21\r\n'
reply: '250 OK\r\n'
reply: retcode (250); Msg: OK
send: 'rcpt TO:<myUserName at hcoop.net>\r\n'
reply: '250 Accepted\r\n'
reply: retcode (250); Msg: Accepted
send: 'data\r\n'
reply: '354 Enter message, ending with "." on a line by itself\r\n'
reply: retcode (354); Msg: Enter message, ending with "." on a line by itself
data: (354, 'Enter message, ending with "." on a line by itself')
send: 'This is a trial.\r\n..\r\n.\r\n'
reply: '250 OK id=1NLake-0002hx-2v\r\n'
reply: retcode (250); Msg: OK id=1NLake-0002hx-2v
data: (250, 'OK id=1NLake-0002hx-2v')
{}
My problem is that I'm not getting any message at all... Is there a
way of configuring the smtp server to send mails? I searched the
mailing list but did not find help there.
Cheers,
Alex
More information about the HCoop-Help
mailing list