[Python] SMTP server based on Python?

2006-12-06 Thread Peter Smith [gjfc]
People,

I have sendmail working on my linux box.

Since I can use sendmail to send e-mails, would it be easy to write a
simple Python class which listens for data on port 25?

Then, if it gets some data, it just passes it to sendmail.

Do any of you know if such a simple script is floating around somewhere
on the net?

...Peter
http://GoodJobFastCar.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python] SMTP server based on Python?

2006-12-06 Thread Fredrik Lundh
Peter Smith [gjfc] wrote:
 I have sendmail working on my linux box.
 
 Since I can use sendmail to send e-mails, would it be easy to write a
 simple Python class which listens for data on port 25?
 
 Then, if it gets some data, it just passes it to sendmail.
 
 Do any of you know if such a simple script is floating around somewhere
 on the net?

  import smtpd

/F

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python] SMTP server based on Python?

2006-12-06 Thread Tim Roberts
Peter Smith [gjfc] [EMAIL PROTECTED] wrote:

I have sendmail working on my linux box.

Since I can use sendmail to send e-mails, would it be easy to write a
simple Python class which listens for data on port 25?

Then, if it gets some data, it just passes it to sendmail.

Ummm, I'm rather confused as to why you don't just have sendmail do this.
After all, that is its primary function: to run as a daemon, listening on
port 25, and delivering incoming messages to local mailboxes.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python SMTP server

2005-08-01 Thread Benjamin Niemann
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/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python SMTP server

2005-08-01 Thread Cliff Wells
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

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python SMTP server

2005-08-01 Thread Benjamin Niemann
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/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python SMTP server

2005-07-31 Thread Benjamin Niemann
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/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python SMTP server

2005-07-31 Thread Cliff Wells
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

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


-- 
http://mail.python.org/mailman/listinfo/python-list


python SMTP server

2005-07-30 Thread Fernando M.
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.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python SMTP server

2005-07-30 Thread Cliff Wells
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

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


-- 
http://mail.python.org/mailman/listinfo/python-list