473,387 Members | 1,470 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.

SMTP server w/o using Twisted framework

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?

Jul 5 '07 #1
8 1651
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 <ti**********@gmail.comwrote:
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
Jul 5 '07 #2
On Jul 5, 1:34 pm, "Jeff McNeil" <j...@jmcneil.netwrote:
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?

Jul 5 '07 #3
Inline...

On 7/5/07, _spitFIRE <ti**********@gmail.comwrote:
On Jul 5, 1:34 pm, "Jeff McNeil" <j...@jmcneil.netwrote:
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
Jul 5 '07 #4
On Jul 5, 2:21 pm, Jean-Paul Calderone <exar...@divmod.comwrote:
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.

Jul 5 '07 #5
On Jul 5, 2:37 pm, "Jeff McNeil" <j...@jmcneil.netwrote:
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.

Jul 5 '07 #6
_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
Jul 6 '07 #7
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 -------------
Jul 6 '07 #8
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 -------------

Jul 6 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Curtis Ransom | last post by:
I am trying to send an email through a smtp server on a different box. In CDO there was a group of Configurations (referencing the cdo schemas) I could set to do the authentication. Well in .NET,...
2
by: Chris Pearson | last post by:
I recently set up a web site which I am running locally on my laptop using ASP.Net. From a web form on the site I am attempting to send an email programmatically using the CDONTS class to an SMTP...
0
by: techie | last post by:
I'm trying to use system.web.mail to send an email, but the smtp server requires authentication. I came across some info about fields property Dim mail As New MailMessage() mail.To =...
2
by: Dave | last post by:
Hello, I am trying to write an application that will talk to an SMTP server using sockets. I can connect to the server just fine, then I can receive the first message from the server. I can then...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
1
by: fabrizio.viggiani | last post by:
I need to send a mail message to an SMTP server. The .net framework provides System.Net.Mail namespace to send an email: - Build a System.Net.Mail.MailMessage and send it using SmtpClient The...
1
by: NARSIREDDY | last post by:
Hi, I want to setup SMTP server using IIS to send mails through ASP.Net. I request you to pls help in this regard. yours amiably, narsi reddy
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.