Sending e-mail

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


On Aug 28, 12:52 pm, peter.jones.... at gmail.com 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 (http://www.devshed.com/c/a/Python/
> 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("smtp.gmail.com")
>
> I also pinged smtp.gmail.com 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 (http://docs.python.org/lib/
> 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.

http://codecomments.wordpress.com/2008/01/04/python-gmail-smtp-example/



More information about the Python-list mailing list