use smtpd as a gmail proxy server

Robin Becker robin at
Wed Apr 22 14:14:45 CEST 2009

A bit of googling reveals that it's possible to use smtplib to do mailing using 
gmail. Is there a way to use smtpd as a proxy server with gmail.

This apparently works with smtplib,

>   mailServer = smtplib.SMTP('', 587)
>   mailServer.ehlo()
>   mailServer.starttls()
>   mailServer.ehlo()
>   mailServer.login(gmailUser, gmailPassword)
>   mailServer.sendmail(gmailUser, recipient, msg)
>   mailServer.close()

but I'm trying to test an application that will use its host's mta eventually to 
send mail so I need to set up a local proxy that can log in to gmail.

Is there an easy way forward with smtpd?

Looking in the PureProxy code it seems that I need to mess with the _deliver 
method to use the above approach, but there isn't any convenient hook.
Robin Becker

More information about the Python-list mailing list