Sending e-mail

Waldemar Osuch waldemar.osuch at
Thu Aug 28 20:59:54 CEST 2008

On Aug 28, 12:52 pm, peter.jones.... at wrote:
> I work at a training center and I would like to use Python to generate
> a number of certificates and then e-mail them. The certificates are a
> problem for another day - right now I just want to figure out how to
> send an e-mail.
> I confess I don't know much about the protocol(s) for e-mail. In PHP
> using CodeIgniter, the same task was amazingly easy. I think this is a
> bit harder because I'm not executing code on a remote machine that has
> its own SMTP server. According to (
> Python-Email-Libraries-SMTP-and-Email-Parsing/), I need to use the
> SMTP object found in the smtplib module to initiate a connection to a
> server before I can send. I want to use Gmail, but on the following
> input it stalls and then raises smtplib.SMTPServerDisconnected:
> server = SMTP("")
> I also pinged and tried it with the dotted quad IP as a
> string. Am I on the right track? Is this a problem with gmail, or have
> I gotten an assumption wrong?
> Here's a thought: Could I use SMTPServer (
> node620.html) to obviate the need to have anything to do with Gmail?
> What would be the limitations on that? Could I successfully do this
> and wrap the whole thing up in a black box? What modules would I need?
> Thanks.

Gmail SMTP server needs authentication.
I little googling found this example.
I did not test it if it works but it could be starting point.

More information about the Python-list mailing list