Cyber Deals - Get up to 65% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

GCP - Sending email with SendGrid

GCP - Sending email with SendGrid

ref: https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-16-04

If you need to ever return to re-adjust these settings, you can do so by typing:

sudo dpkg-reconfigure postfix

  • Generate the SASL password map using the API key you generated in the Before you begin section:

echo [smtp.sendgrid.net]:2525 apikey:[YOUR_API_KEY] » /etc/postfix/sasl_passwd

  • Use the postmap utility to generate a .db file:

postmap /etc/postfix/sasl_passwd

  • Restart postfix
# /etc/init.d/postfix restart
[ ok ] Restarting postfix (via systemctl): postfix.service.
  • install mailutils or mailx
apt-get install mailutils -y

echo “Hello” | mail -s Test106 -r ‘[email protected]’ [email protected]

echo “Hello” | mail -s Test107 –append=“FROM:[email protected]” -r ‘[email protected]’ [email protected]

Disclaimer: Views expressed in articles are those of the respective authors and do not necessarily reflect the views of their employers or this site. While we aim for accuracy, please verify information before relying on it, and let us know if you spot an error.
Share: