Drupal 8 vs me

Drupal 8 vs me

Tuesday, March 3, 2015

Sending Email From Wordpress on Google Cloud Compute

Sending Email From Wordpress on Google Cloud Compute is a tad difficult when Google does not support and of the outbound email ports.

But there is a workaround, fortunately :)




Sign up for a free "SendGrid" account, fill in all the details and wait +- 2-3 hours for them to reply with confirmation that you and your website have been accepted.

I then went for the Postfix option as java and I are not friends.
Goto Google Developers Console and click on Wordpress project and then the SSH button.

I have only done this once and it worked (somehow), my Instance is based on Debian and my wordpress site is running "Contact form 7" and "really Simple CAPTCHA" plugins for people to contact me through the site.

Just found this, more detailed; https://cloud.google.com/compute/docs/tutorials/sending-mail

** THIS IS STILL VERY MUCH A WORK IN PROGRESS **

The steps are as follows;

sudo su
$ cd /
$ umask 077
$ apt-get update

$ apt-get install postfix
-- A few Questions are asked here, I just went for what was already selected, you can always uninstall postfix should a cock-up occur.

$ cat > /etc/postfix/sasl_passwd << EOF [smtp.sendgrid.net]:2525 sendgrid-username:sendgrid-password EOF

postmap /etc/postfix/sasl_passwd
ls -l /etc/postfix/sasl_passwd*


$ nano /etc/postfix/main.cf

-- Now add this below the last line (#relay_transport = error) of the main.cf page you have nano'd into and save the file;
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:2525

$ apt-get install libsasl2-modules
$ postfix reload

-- Now send a test message to a existing email account to see if all is working.
$ printf 'Subject: test-via-sendgrid\r\n\r\npassed' | sendmail your@email.com
-- You can check the log file if you want;
$ tail -n 5 /var/log/syslog

-- Last but not least, remove the sasl_passwd file create earlier.
$ rm -f /etc/postfix/sasl_passwd$