Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61853 > unrolled thread

Re: Using pythons smtp server

Started byVincent Davis <vincent@vincentdavis.net>
First post2013-12-13 10:44 -0700
Last post2013-12-13 18:12 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Using pythons smtp server Vincent Davis <vincent@vincentdavis.net> - 2013-12-13 10:44 -0700
    Re: Using pythons smtp server Grant Edwards <invalid@invalid.invalid> - 2013-12-13 18:12 +0000

#61853 — Re: Using pythons smtp server

FromVincent Davis <vincent@vincentdavis.net>
Date2013-12-13 10:44 -0700
SubjectRe: Using pythons smtp server
Message-ID<mailman.4088.1386957805.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Obviously I don't really know how this works. I have used python to send
email using "my" smtp server (whatever that may be gmail, postfix..)
But I don't want to do that. After a little more research I think what I
need to do is lookup the MX address of the address I want to send the email
too.
Then submit the email to that address using smtplib.SMTP
​Do I have that right?
​


Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 10:24 AM, Dennis Lee Bieber
<wlfraed@ix.netcom.com>wrote:

> On Thu, 12 Dec 2013 18:01:58 -0700, Vincent Davis
> <vincent@vincentdavis.net> declaimed the following:
>
> >I have an app that generates a file one a day and would like to email it
> >using pythons SMTP server.
> >http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
> >The documentation is kinda sparse and I cant seem to find any good
> examples.
> >
> >Basically what I want to do; when my app runs it would initiate a SMTP
> >server, send the attachment and shutdown the SMTP after.
> >
>
>         I suspect you don't want the "server" per se -- that's more a unit
> for
> receiving SMTP mail (sure, you can start it, but then you have to send the
> email to IT so it can relay it to the next server in the line).
>
>         Look into the smtplib module (section 20.12 in the v2.7.2
> documentation) in order to send email TO a mail server
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>     wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

[toc] | [next] | [standalone]


#61856

FromGrant Edwards <invalid@invalid.invalid>
Date2013-12-13 18:12 +0000
Message-ID<l8filn$9el$1@reader1.panix.com>
In reply to#61853
On 2013-12-13, Vincent Davis <vincent@vincentdavis.net> wrote:

> Obviously I don't really know how this works. I have used python to
> send email using "my" smtp server (whatever that may be gmail,
> postfix..) But I don't want to do that. After a little more research
> I think what I need to do is lookup the MX address of the address I
> want to send the email too.
>
> Then submit the email to that address using smtplib.SMTP

Maybe.  In theory, that will work -- and it did in the good old days
before SPAM (the electric kind) was invented.

But, many SMTP servers (the ones pointed to by the MX record) will not
accept mail from you unless you meet various requirements (which vary
considerably and the SMTP servers administrators try to keep secret).

For example you may have to be sending from an IP address who's
reverse-DNS lookup matches up with the from headers and with the MX
record for the domain you claim to be sending from.

Your mail might also get blocked/discarded if you're sending from
what's been identified as a dynamically allocated IP block (even if it
does have proper DNS and MX records).

-- 
Grant Edwards               grant.b.edwards        Yow! Look into my eyes and
                                  at               try to forget that you have
                              gmail.com            a Macy's charge card!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web