Re: sendmail library ?!
On 2013-11-18, Tim Roberts t...@probo.com wrote: Tamer Higazi th9...@googlemail.com wrote: I am looking for a python library that does mailing directly through sendmail. When I look into the docs, I see only an smtlip library but nothing that could serve with sendmail or postfix. Any ideas ?! Remember that import smtplib s = smtplib.SMTP(localhost) usually communicates directly with the local server, whether it be sendmail or postfix or whatever. It's not uncommon for a machine that doesn't receive mail to have sendmail/postfix/whatever installed for the purpose of sending mail only. In that case, there might not be anybody listening on (localhost,smtp). The traditional way to send mail on a Unix system is to invoke the 'sendmail' command with appropriate command-line arguments and then shove the message into sendmail's stdin. It's pretty trivial -- here's a simple sendmail library: def sendmail(frm,to,msg): with os.popen(sendmail -f '%s' '%s' % (frm,to), w) as p: p.write(msg) That works on my system, but YMMV. You might like more options (like automagically parsing frm/to address from msg headers or whatnot), and those are left as an exercise for the reader. -- Grant Edwards grant.b.edwardsYow! Did an Italian CRANE at OPERATOR just experience gmail.comuninhibited sensations in a MALIBU HOT TUB? -- https://mail.python.org/mailman/listinfo/python-list
Re: sendmail library ?!
On Tue, Nov 12, 2013 at 8:52 PM, Tamer Higazi th9...@googlemail.com wrote: Hi people! I am looking for a python library that does mailing directly through sendmail. I use: http://stromberg.dnsalias.org/svn/mailer/trunk/mailer.py -- https://mail.python.org/mailman/listinfo/python-list
Re: sendmail library ?!
Tamer Higazi th9...@googlemail.com wrote: I am looking for a python library that does mailing directly through sendmail. When I look into the docs, I see only an smtlip library but nothing that could serve with sendmail or postfix. Any ideas ?! Remember that import smtplib s = smtplib.SMTP(localhost) usually communicates directly with the local server, whether it be sendmail or postfix or whatever. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list
sendmail library ?!
Hi people! I am looking for a python library that does mailing directly through sendmail. When I look into the docs, I see only an smtlip library but nothing that could serve with sendmail or postfix. Any ideas ?! Thanks Tamer -- https://mail.python.org/mailman/listinfo/python-list
Re: sendmail library ?!
On 13Nov2013 05:52, Tamer Higazi th9...@googlemail.com wrote: I am looking for a python library that does mailing directly through sendmail. When I look into the docs, I see only an smtlip library but nothing that could serve with sendmail or postfix. Use the subprocess module. Pipe to: /usr/sbin/sendmail -oi addr1 addr2 ... If the exit code is 0, mail dispatched. This is a trivial function; you don't need a library for this. Both sendmail and postfix (and qmail et al) provide a sendmail executable for exactly this purpose. The smtplib is for making arbitrary SMTP operations, thus a whole module. Sendmail does all that for you, you only need to deliver the message to it and ensure it was accepted. Cheers, -- Cameron Simpson c...@zip.com.au The mere existence of a problem is no proof of the existence of a solution. - Yiddish Proverb -- https://mail.python.org/mailman/listinfo/python-list