-1

Recently I am studying email-related and have written a simple mail client to send emails. But unfortunately due to the bad network I can not connect to smtp.gmail.com home. It is OK when I use a proxy in the browser, also OK when the script is run in company.

So are there any methods to set a proxy for smtp protocol? I don't see anything I can use in the smtplib module in Python2.7. And I think it is of no use to set the http proxy. They are two kinds of protocols. I have also searched Google and stackoverflow and can not find a reasonable resolution.

So, it seems there is a socket proxy. Is that useful?

Hope somebody could tell me something.

user2086454
  • 73
  • 1
  • 4

1 Answers1

1

Install a local mail server which maintains its own mail queue like Postfix. Your own, local mail server actually is a caching SMTP-proxy, so exactly what you want to do. Your local application will deliver its mail to Postfix which makes sure the mail gets delivered to the actual recipient. There are lots of other mail servers doing this job totally fine, too.

Setting up Postfix is out of scope for an SO-Answer (or ServerFault, I guess it gets migrated), but there are lots of tutorials round there (and it depends on the machine you're using). Setting up postfix to use Gmail as smarthost will be of interest for you, too, as it involves some smaller hassles with certificates.

Jens Erat
  • 37,523
  • 16
  • 80
  • 96