Using Gmail smtp through VPN (on Synology)

I use my Synology NAS with a VPN which is always connected. In response to some events I wanted to send custom email notifications (btw if you are interested in this part I recommend this excellent article Send Custom (email) Notifications from scripts running on a Synology).

I use the Gmail’s smtp server with one of my email.
In general there are several things you need to do to make it work:

  1. Ask your vpn provider to whitelist the ip of the gmail smtp you resolve once connected (to get the ip you resolve from vpn: ssh/telnet to your nas with root user and ping -4 smtp.gmail.com). Indeed most providers block smtp in order to prevent spams. My provider (privateinternetaccess) has whitelisted the ip in 24h
  2. Fill the ip in the notification panel (as on the picture)
  3. Send a test mail
  4. If you receive a mail from Google saying your account might have been hacked log on gmail, then go to https://accounts.google.com/DisplayUnlockCaptcha and send a test mail again

Synology notification panel

It now should works! Hope it has helped 🙂

Advertisements
This entry was posted in tutorial, vpn and tagged , , , . Bookmark the permalink.