[Tutor] smtplib alternative???

Nick Lunt nick at javacat.f2s.com
Sun Nov 20 16:39:53 CET 2005

Hi Adisegna,

Lets say that you are someone at abc.com and you want to send email to
a at abc.com, b at xyz.com and c at duff.com .

You setup SMTPLib to talk to the MX server for abc.com which all users on
abc.com use to send email.
SMTP connects to that email server and you can send emails to anyone you
like (unless theyre blacklisted).

So by telling python to use mailserver at abc.com (your ISP's mail server) you
can send email to a at abc.com (obviously), b at xyz.com (because your a member of
abc.com) and c at duff.com (again cos your a member of abc.com).

However, if you want your emails to be received with a different address, ie
your using the isp abc.com and you want to send an email to b at xyz.com and it
to appear to have come from you at pinkstuff.com then you will need to tell
pythons smptlib to connect to the MX server for pinkstuff.com to send the
email, and you'll probably have to be dialled in to pinkstuff.com.

Webmail MX servers differ in that they require authentication so it doesnt
matter which ISP your dialled in from.

Generally smtp servers are only configured to send to or from domains in
which they belong.

Hope that helps,
Nick .

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On Behalf Of
Sent: 20 November 2005 14:26
To: Danny Yoo
Cc: tutor at python.org
Subject: Re: [Tutor] smtplib alternative???

Hi Danny,

Yes, when sending an email your mail client will always send the email to
the mail server specified by the MX record in the authoritive domain.
Usually the domain specificed after the @ symbol. The problem with smtplib
is that I have to specify the mail server I'm sending email too. What if I
wanted to send an email to 3 different people on three different domains
hosted by 3 different mail servers? Smtlib prohibits this functionality. Do
you see what I mean now...?

Thanks for replying...

On 11/20/05, Danny Yoo < dyoo at hkn.eecs.berkeley.edu> wrote:

On Sat, 19 Nov 2005, Adisegna wrote:

> I found this script to send mail online. It works fine but requires me
> to enter an mail server. I'm looking for something else that doesn't
> require and SMTP server. Having to specify a mail server prohibits me
> from sending to alternate domains.

Hi Adisegna,

I've always assumed that emails have to talk with some SMTP server.
RFC821 seems to confirm this:


so what you're asking, to be able to send mail without an SMTP server, may
not be possible.  There is an 'smtpd' module that comes with Python:


I'm also not sure I understand the reason you're trying to avoid talking
to an outside smtp server.  But again, I'm unfamiliar enough with how the
SMTP email protocol really works that perhaps I'm just overlooking

Arthur DiSegna
Network Operations Center
Authentium, Inc.

More information about the Tutor mailing list