Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59284 > unrolled thread
| Started by | Tamer Higazi <th982a@googlemail.com> |
|---|---|
| First post | 2013-11-13 05:52 +0100 |
| Last post | 2013-11-18 17:56 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
sendmail library ?! Tamer Higazi <th982a@googlemail.com> - 2013-11-13 05:52 +0100
Re: sendmail library ?! Tim Roberts <timr@probo.com> - 2013-11-17 21:00 -0800
Re: sendmail library ?! Grant Edwards <invalid@invalid.invalid> - 2013-11-18 17:56 +0000
| From | Tamer Higazi <th982a@googlemail.com> |
|---|---|
| Date | 2013-11-13 05:52 +0100 |
| Subject | sendmail library ?! |
| Message-ID | <mailman.2524.1384318364.18130.python-list@python.org> |
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
[toc] | [next] | [standalone]
| From | Tim Roberts <timr@probo.com> |
|---|---|
| Date | 2013-11-17 21:00 -0800 |
| Message-ID | <vk7j89tmt6vki78112v7p4st931nkhh4o7@4ax.com> |
| In reply to | #59284 |
Tamer Higazi <th982a@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, timr@probo.com
Providenza & Boekelheide, Inc.
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2013-11-18 17:56 +0000 |
| Message-ID | <l6dkbu$1oh$1@reader1.panix.com> |
| In reply to | #59834 |
On 2013-11-18, Tim Roberts <timr@probo.com> wrote:
> Tamer Higazi <th982a@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.edwards Yow! Did an Italian CRANE
at OPERATOR just experience
gmail.com uninhibited sensations in
a MALIBU HOT TUB?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web