Google Cloud Platform Quick Setup for Sending Mails.
a bit complicated procedure,
since you need to have a 3rd party's account, SendGrid.
Send Grid is free for 100 mails/day forever.
as of 2019/10/28.
- SendGrid Account for API Key
- Sign in or Create an account: SendGrid
- Settings -> API Keys
- Postfix installation on your instance(Google-Cloud).
- $ ssh google cloud.
- $ sudo su - (from google cloud help)
- # umask 077 (from google cloud help)
- # apt-get install postfix
- Select "Local only".
- Accept "instance-1.us-central1-a.c.voltaic-psyche-2*.internal".
- # emacs /etc/postfix/main.cf
- comment out
#default_transport = error
#relay_transport = error
- Add below
relayhost = [smtp.sendgrid.net]:2525
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous
- # emacs /etc/postfix/sasl_passwd
[smtp.sendgrid.net]:2525 apikey:YOUR_API_KEY
- postmap /etc/postfix/sasl_passwd # to create sasl_passwd.db
- /etc/init.d/postfix restart
- Test
- # apt-get install mailx
- # echo 'test' | mail -s subject test@testc.com
- You will get the email immediately! Done!
- # tail -n 5 /var/log/syslog # for checking!
Since 20191029