Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SMTP server w/o using Twisted framework

Reply
Thread Tools

SMTP server w/o using Twisted framework

 
 
_spitFIRE
Guest
Posts: n/a
 
      07-05-2007
Is it possible to run a SMTP server that sends mail to recipients
using standard libraries, without using twisted framework, and also
without using any relay server?

 
Reply With Quote
 
 
 
 
Jeff McNeil
Guest
Posts: n/a
 
      07-05-2007
If you just want to send mail, you should be able to use the standard
smtplib module (http://docs.python.org/lib/module-smtplib.html). If
your recipients are on the Internet, you would need to handle MX
resolution yourself.

I know you said you want to avoid a relay server, but it's probably
the best bet unless you control the SMTP infrastructure or are simply
sending messages locally. Otherwise, you'll probably need to also
implement queuing and retry logic (depending on your requirements).
There are also some warning lights that may go off and flag your mail
as spam if you're using a method like that...

-Jeff

On 7/5/07, _spitFIRE <(E-Mail Removed)> wrote:
> Is it possible to run a SMTP server that sends mail to recipients
> using standard libraries, without using twisted framework, and also
> without using any relay server?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

 
Reply With Quote
 
 
 
 
_spitFIRE
Guest
Posts: n/a
 
      07-05-2007
On Jul 5, 1:34 pm, "Jeff McNeil" <(E-Mail Removed)> wrote:
> If you just want to send mail, you should be able to use the standard
> smtplib module (http://docs.python.org/lib/module-smtplib.html). If
> your recipients are on the Internet, you would need to handle MX
> resolution yourself.
>


How complicated is to handle the MX resolution by myself? I'm sorry
that I don't have a clue regarding that. Any pointers would be greatly
appreciated.

> I know you said you want to avoid a relay server, but it's probably
> the best bet unless you control the SMTP infrastructure or are simply
> sending messages locally.


The problem is that with the scenario I'm faced with, I don't have any
reliable SMTP server that I can use. Hence, I though I will spawn my
own light-weight SMTP server that can send mails to the people I want,
on the Internet. But, from what you are saying it seems, it might not
be that light weight after all!

> Otherwise, you'll probably need to also
> implement queuing and retry logic (depending on your requirements).


Isn't there a library module that can help me implement all this?

> There are also some warning lights that may go off and flag your mail
> as spam if you're using a method like that...
>
> -Jeff


Would you please fill me in with some pointers as to why my mail might
get flagged as spam? Would it be considered spam even if I've a valid
from address, and a proper message/subject? Does the spam filter also
rely on the sending server's DNS etc because of which you say it might
get flagged as spam?

 
Reply With Quote
 
Jeff McNeil
Guest
Posts: n/a
 
      07-05-2007
Inline...

On 7/5/07, _spitFIRE <(E-Mail Removed)> wrote:
> On Jul 5, 1:34 pm, "Jeff McNeil" <(E-Mail Removed)> wrote:
> > If you just want to send mail, you should be able to use the standard
> > smtplib module (http://docs.python.org/lib/module-smtplib.html). If
> > your recipients are on the Internet, you would need to handle MX
> > resolution yourself.
> >

>
> How complicated is to handle the MX resolution by myself? I'm sorry
> that I don't have a clue regarding that. Any pointers would be greatly
> appreciated.


You could try pyDNS (http://pydns.sourceforge.net). You should simply
be able to call the 'DNS.mxlookup' function. The other option would
be twisted.names...

>
> > I know you said you want to avoid a relay server, but it's probably
> > the best bet unless you control the SMTP infrastructure or are simply
> > sending messages locally.

>
> The problem is that with the scenario I'm faced with, I don't have any
> reliable SMTP server that I can use. Hence, I though I will spawn my
> own light-weight SMTP server that can send mails to the people I want,
> on the Internet. But, from what you are saying it seems, it might not
> be that light weight after all!


What about simply running an SMTP server on the machine running your
application? Is that a possible approach?

>
> > Otherwise, you'll probably need to also
> > implement queuing and retry logic (depending on your requirements).

>
> Isn't there a library module that can help me implement all this?


Not that I know of. The protocol is standard, the queuing and retry
logic, not so much. Someone else may know more than I, though.

>
> > There are also some warning lights that may go off and flag your mail
> > as spam if you're using a method like that...
> >
> > -Jeff

>
> Would you please fill me in with some pointers as to why my mail might
> get flagged as spam? Would it be considered spam even if I've a valid
> from address, and a proper message/subject? Does the spam filter also
> rely on the sending server's DNS etc because of which you say it might
> get flagged as spam?
>


http://mtamark.space.net/draft-stump...tamark-04.html
http://en.wikipedia.org/wiki/Sender_Policy_Framework

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

 
Reply With Quote
 
_spitFIRE
Guest
Posts: n/a
 
      07-05-2007
On Jul 5, 2:21 pm, Jean-Paul Calderone <(E-Mail Removed)> wrote:
> You need to do a DNS MX lookup. There's nothing in the Python stdlib
> which provides this functionality. There are several libraries available
> which do this, though (Twisted among them . You can probably find them
> with a little googling. Beyond that, the rules for processing MX records
> are simple and it's not much work to pick the right host once you can do
> the MX lookups.
>
> Jean-Paul


Thanks for the pointer. However, as I said currently, I can't use
anything other than the standard libraries.

 
Reply With Quote
 
_spitFIRE
Guest
Posts: n/a
 
      07-05-2007
On Jul 5, 2:37 pm, "Jeff McNeil" <(E-Mail Removed)> wrote:
> You could try pyDNS (http://pydns.sourceforge.net). You should simply
> be able to call the 'DNS.mxlookup' function. The other option would
> be twisted.names...
>


Thanks for the pointers.

> What about simply running an SMTP server on the machine running your
> application? Is that a possible approach?
>


I guess that would be my last resort

> Not that I know of. The protocol is standard, the queuing and retry
> logic, not so much. Someone else may know more than I, though.
>


I understand what you are saying. I guess, I would fall back to my
last option!

> http://mtamark.space.net/draft-stump...licy_Framework
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list


Thanks, once again.

 
Reply With Quote
 
=?ISO-8859-1?Q?Gerhard_H=E4ring?=
Guest
Posts: n/a
 
      07-06-2007
_spitFIRE wrote:
> [looking up DNS MX records]
> Thanks for the pointer. However, as I said currently, I can't use
> anything other than the standard libraries.


Sure you can. You just need to get rid of the "only standard library"
requirement rule.

That works best by showing the alternatives to whoever set that requirement:

- use pyDNS
- use an existing (probably non-Python) SMTP daemon
- reimplement some parts of pyDNS yourself and develop a basic (crappy)
SMTP daemon yourself

For doing the latter, you should budget at least one week.

FWIW another reason why SMTP servers should retry on temporary failure
is that increasing use of Greylisting (*), which was precisely designed
to filter out mail from "crappy" servers, like botnets, and - well -
cheap custom written ones

-- Gerhard


(*) http://en.wikipedia.org/wiki/Greylisting - I use it myself
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      07-06-2007
Gerhard Häring wrote:
> _spitFIRE wrote:
>> [looking up DNS MX records]
>> Thanks for the pointer. However, as I said currently, I can't use
>> anything other than the standard libraries.

>
> Sure you can. You just need to get rid of the "only standard library"
> requirement rule.
>
> That works best by showing the alternatives to whoever set that requirement:
>
> - use pyDNS
> - use an existing (probably non-Python) SMTP daemon
> - reimplement some parts of pyDNS yourself and develop a basic (crappy)
> SMTP daemon yourself
>
> For doing the latter, you should budget at least one week.
>
> FWIW another reason why SMTP servers should retry on temporary failure
> is that increasing use of Greylisting (*), which was precisely designed
> to filter out mail from "crappy" servers, like botnets, and - well -
> cheap custom written ones
>

I'd actually use dnspython in preference to pyDNS, it's very easy to
use. I have some MX-server lookup code somewhere in the vault, if you
can use an external library.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      07-06-2007
Gerhard Häring wrote:
> _spitFIRE wrote:
>> [looking up DNS MX records]
>> Thanks for the pointer. However, as I said currently, I can't use
>> anything other than the standard libraries.

>
> Sure you can. You just need to get rid of the "only standard library"
> requirement rule.
>
> That works best by showing the alternatives to whoever set that requirement:
>
> - use pyDNS
> - use an existing (probably non-Python) SMTP daemon
> - reimplement some parts of pyDNS yourself and develop a basic (crappy)
> SMTP daemon yourself
>
> For doing the latter, you should budget at least one week.
>
> FWIW another reason why SMTP servers should retry on temporary failure
> is that increasing use of Greylisting (*), which was precisely designed
> to filter out mail from "crappy" servers, like botnets, and - well -
> cheap custom written ones
>

I'd actually use dnspython in preference to pyDNS, it's very easy to
use. I have some MX-server lookup code somewhere in the vault, if you
can use an external library.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Twisted-Python] Twisted 13.0.0 released Glyph Python 0 04-03-2013 09:36 PM
Re: [Twisted-Python] Twisted 12.3.0 released Glyph Python 0 12-27-2012 06:40 AM
Re: [Twisted-Python] Re-working a synchronous iterator to use Twisted Jean-Paul Calderone Python 0 06-17-2008 10:14 PM
twisted mail server - SMTP AUTH extension not supported Mark Carter Python 2 12-30-2003 10:16 PM
A very simple benchmark of Python based web server: Zope, mod_python with Apache, Twisted Framework Bowen Chiu Python 1 08-09-2003 05:50 PM



Advertisments