/ ghost

Setup email for ghost blog

So after I had my blog up, there was a crucial piece missing for communication. The email service i.e. SMTP. That did not turn up out-of-the-box from the bitnami image for ghost which I honestly felt should have been.

Nevertheless, I knew I had to set it up. I have experience with the Linux SMTP service with postfix but thought to give an AWS first approach. I knew there was a service provided but didn't know what it is.

Amazon SES ? - naah...

After looking up, found it - Simple Email Service
I thought to go with this and spent sometime to set it up but I guess the use case is a bit different from mine. Not to mention the work involved doesn't fit my usage of just a simple SMTP handling the blog emails. I could look into it future and the usage of SES would be ideal for marketing campaigns/ newsletters for the features it provides. But the cost should also justify the usage of SES which is definetly a lot compared to nothing on the already running EC2 server hosting

Postfix to the rescue...

I went with postfix installation and setup. Future would look towards ansible setup of it and maybe docker too.

Postfix documentation can be found at http://www.postfix.org/documentation.html

$ sudo apt-get install postfix

Follow the configurations available
postfix-install-config

I will paste my configurations below,
$ cat /etc/postfix/main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = {hidden}
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, iphilip.org, localhost, blog.iphilip.org
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter =
inet_interfaces = all
inet_protocols = ipv4

Any configuration changes can be initiated by reloading postfix.

Check if SMTP is working by sending a test email to yourself, not an email on the same domain though!

echo "Subject : Sendmail Test" | sendmail -v <email-address-of-another-domain>

If you receive the email then hurray! but not yet, lets check Ghost able to send or not.

Go to your ghost blog admin interface and visit the Teams section.
Try inviting yourself on the email id mentioned above

If you get an invite then Ghost is able to communicate with your SMTP server, hurray now!!



Sources

  1. https://help.ubuntu.com/community/PostfixBasicSetupHowto
  2. http://www.postfix.org/BASIC_CONFIGURATION_README.html
  3. https://docs.ghost.org/docs/mail-config
  4. https://www.ghostforbeginners.com/how-to-configure-ghost-to-send-email/
  5. https://blog.benoitblanchon.fr/postfix-and-ghost/
Setup email for ghost blog
Share this