473,387 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

python SMTP server

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
6 3771
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nancy | last post by:
Hi, Guys, I am new to Python. I am trying to following the example on http://www.modpython.org/live/current/doc-html/tut-pub.html In this example, it gives the following html code, <form...
8
by: JZ | last post by:
I cannot find out what is the problem with my Python. I cannot join to smtp host. > python Python 2.3.4 (#1, Jun 22 2004, 04:42:42) on linux2 Type "help", "copyright", "credits" or "license"...
5
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # Suppose you want to spam your friend, and you have lots of # friends. The solution is to write a program to do it. After a gander # at python docs, one easily...
14
by: sridhar | last post by:
iam having user account on an exchangeserver. with that can i send an email using python? if iam using the following code iam getting error fromAddress = 'sridhar_kasturi@satyam.com'...
1
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
4
by: krishnakant Mane | last post by:
hello, I am a bit confused. I want to make a program that will take some data from a database and make a string of text. and send it to the respective email id of a person. next I also want to...
3
by: gatoruss | last post by:
Newbie here with a (hopefully not) dumb question....tried searching around on the 'Net without success, so here goes.... I have been playing around with python. I wrote a script that sends an smtp...
1
by: openuser | last post by:
Hello, I've been researching how to embed python into C/C++. And, I learned how to write c/c++ code that, in threory, should do its job in embedding Python module into itself. Here is what I have.....
9
by: brad | last post by:
I'd like to send email directly from within python without having to rely on an external smtp server. You know, something like the good, old Unix... echo My_message | mail -s Subject...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.