By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,538 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,538 IT Pros & Developers. It's quick & easy.

python SMTP server

P: n/a
Hi,
i made a test with smtplib module a few days ago, for sending mails,
and i was wondering if there's another module for running an SMTP
server, so i could make a standalone script for sending mails without
using an external SMTP server.
I've been searching but i'm not sure if there are modules for it, or
anything.
Which ones are my options?

Thanks.

Jul 30 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Sat, 2005-07-30 at 14:44 -0700, Fernando M. wrote:
Hi,
i made a test with smtplib module a few days ago, for sending mails,
and i was wondering if there's another module for running an SMTP
server, so i could make a standalone script for sending mails without
using an external SMTP server.
I've been searching but i'm not sure if there are modules for it, or
anything.
Which ones are my options?


You might take a look at:

http://www.divmod.org/projects/quotient

It does quite a bit more than just SMTP, but that is included.

However, you should note that if you are running the server at home,
chances are that most mail servers will reject mail from your system.
It's best to use the server your ISP provides. You can have your local
SMTP server forward through your ISP's server, but this is, in most
cases, unneeded complexity.

Regards,
Cliff

--
cl***@develix.com
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and Python specialists ::
Jul 30 '05 #2

P: n/a
Fernando M. wrote:
Hi,
i made a test with smtplib module a few days ago, for sending mails,
and i was wondering if there's another module for running an SMTP
server, so i could make a standalone script for sending mails without
using an external SMTP server.
I've been searching but i'm not sure if there are modules for it, or
anything.
Which ones are my options?


An SMTP server is (simplified) a program that listens on port 25 for
incoming mails.

What you probably want to do is:
Do a DNS query for the recipent's domain and use smtplib to connect to the
server specified in the MX record. There was a module for DNS querie (not
in Python's stdlib), but I forgot how it was called or where you could find
it (try the Vaults of Parnassus or PyPI).

Or you may use an external tool like 'dig' ('dig mx DOMAIN').

But you should be aware of the fact that (if you send mail from a dialup
machine without going through a relay server) your mails will quickly be
marked as spam - I hope you do not intend to send spam...

--

Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 31 '05 #3

P: n/a
On Sun, 2005-07-31 at 13:14 +0200, Benjamin Niemann wrote:
But you should be aware of the fact that (if you send mail from a dialup
machine without going through a relay server) your mails will quickly be
marked as spam - I hope you do not intend to send spam...


Yah, Postfix on my servers uses several dnsbl's which automatically
reject home users (unless they authenticate first). Even if this isn't
the case for the majority of SMTP servers today I expect it won't be
long before it is.

As an aside, I will say that many SMTP servers that service home users
(i.e. Comcast, et al) limit the amount of mail that you can send within
a defined period. By using a local SMTP server to proxy, your app can
queue up a large amount of mail in a much shorter period. It won't
necessarily go out any faster, but at least your app won't be tied up
waiting for the mail to be accepted. So there is perhaps one useful
(beyond learning and fun) application for using a local SMTP server.

Regards,
Cliff

--
cl***@develix.com
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and Python specialists ::
Jul 31 '05 #4

P: n/a
Cliff Wells wrote:
On Sun, 2005-07-31 at 13:14 +0200, Benjamin Niemann wrote:
But you should be aware of the fact that (if you send mail from a dialup
machine without going through a relay server) your mails will quickly be
marked as spam - I hope you do not intend to send spam...
Yah, Postfix on my servers uses several dnsbl's which automatically
reject home users (unless they authenticate first). Even if this isn't
the case for the majority of SMTP servers today I expect it won't be
long before it is.

As an aside, I will say that many SMTP servers that service home users
(i.e. Comcast, et al) limit the amount of mail that you can send within
a defined period.


Or completely block outgoing traffic on port 25 except to their own relay...
By using a local SMTP server to proxy, your app can
queue up a large amount of mail in a much shorter period. It won't
necessarily go out any faster, but at least your app won't be tied up
waiting for the mail to be accepted. So there is perhaps one useful
(beyond learning and fun) application for using a local SMTP server.


It would be interesting what the intention of the OP is. I just stumpled
upon a similar problem. The prog I'm currently working on has a function to
report crashes back to me. Originally these reports where sent by mail - no
problem on UNIX/Linux hosts where you can assume to have a working MDA on
localhost. But what to do on Windows systems?!? Ask for a SMTP server
during installation? Confusing as the program itself is totally unrelated
to email. In this case you _could_ deliver the mail directly to my MX
host... But instead of this I installed a small CGI on my website that
sends the mails to me and gets the data via HTTP POST from my app.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Aug 1 '05 #5

P: n/a
On Mon, 2005-08-01 at 12:28 +0200, Benjamin Niemann wrote:
Cliff Wells wrote:

As an aside, I will say that many SMTP servers that service home users
(i.e. Comcast, et al) limit the amount of mail that you can send within
a defined period.


Or completely block outgoing traffic on port 25 except to their own relay...


Luckily I haven't encountered this with Comcast Cable (I use my own
mailserver [requires smtpauth] directly from home as Comcast seems to
have issues with mail and DNS on occasion). If I ever do, I'll
immediately switch to one of the local DSL providers who support Linux.
Better for MTA's to block dynamic/home IP's using dnsbls than have the
ISP limit what you can do with your home computer.
By using a local SMTP server to proxy, your app can
queue up a large amount of mail in a much shorter period. It won't
necessarily go out any faster, but at least your app won't be tied up
waiting for the mail to be accepted. So there is perhaps one useful
(beyond learning and fun) application for using a local SMTP server.


It would be interesting what the intention of the OP is. I just stumpled
upon a similar problem. The prog I'm currently working on has a function to
report crashes back to me. Originally these reports where sent by mail - no
problem on UNIX/Linux hosts where you can assume to have a working MDA on
localhost. But what to do on Windows systems?!? Ask for a SMTP server
during installation? Confusing as the program itself is totally unrelated
to email. In this case you _could_ deliver the mail directly to my MX
host... But instead of this I installed a small CGI on my website that
sends the mails to me and gets the data via HTTP POST from my app.


You can also use port redirection to bypass this sort of thing. Send on
port 10025 instead and direct your MTA to listen on both ports.

Regards,
Cliff

--
cl***@develix.com
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and Python specialists ::
Aug 1 '05 #6

P: n/a
Cliff Wells wrote:
On Mon, 2005-08-01 at 12:28 +0200, Benjamin Niemann wrote:
Cliff Wells wrote:


[snip]
> By using a local SMTP server to proxy, your app can
> queue up a large amount of mail in a much shorter period. It won't
> necessarily go out any faster, but at least your app won't be tied up
> waiting for the mail to be accepted. So there is perhaps one useful
> (beyond learning and fun) application for using a local SMTP server.


It would be interesting what the intention of the OP is. I just stumpled
upon a similar problem. The prog I'm currently working on has a function
to report crashes back to me. Originally these reports where sent by mail
- no problem on UNIX/Linux hosts where you can assume to have a working
MDA on localhost. But what to do on Windows systems?!? Ask for a SMTP
server during installation? Confusing as the program itself is totally
unrelated to email. In this case you _could_ deliver the mail directly to
my MX host... But instead of this I installed a small CGI on my website
that sends the mails to me and gets the data via HTTP POST from my app.


You can also use port redirection to bypass this sort of thing. Send on
port 10025 instead and direct your MTA to listen on both ports.

This would still be problematic with company firewall that block everything
but a handful of ports. Port 80 is still one of the safest bets.
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Aug 1 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.