Since each mail server can be configured differently, I will just try to provide a general example that you can modify to suit your needs. I will use Gmail as an example. This assumes you have a Gmail account and by no means do I encourage you to use Gmail, you would have to review their Terms of Service to see if doing so is acceptable. This post is strictly for illustrative purposes and can be used as an example for configuring for your ISP or company's mail relay.
- Setup, Register the JumpBox, then enable SSH.
- Log into the shell and run the following commands:
sudo apt-get update sudo apt-get install ca-certificates
- Edit the /etc/postfix/main.cf file with sudo nano /etc/postfix/main.cf, put the following at the end, substituting the appropriate relayhost and smtp_tls_CAfile if necessary
smtp_use_tls = yes smtp_tls_CAfile = /etc/ssl/certs/Thawte_Premium_Server_CA.pem smtpd_sasl_auth_enable = no smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtpd_sasl_local_domain = $myhostname smtpd_sasl_application_name = smtpd relayhost = [smtp.gmail.com]
- Now create the file /etc/postfix/sasl_passwd with sudo nano /etc/postfix/sasl_passwd and it should have the following contents:
[smtp.gmail.com] USER@gmail.com:PASSWORD
- Last, we just have to run the following two commands:
sudo postmap /etc/postfix/sasl_passwd sudo postfix reload
You can now test to see if email gets delivered on the command line by issuing the following command (substituting your email address of course):
sendmail -t user@example.com < /etc/services
You should get the contents of the /etc/services file in the mail. Now that you know mail is sending from the JumpBox itself, you should go test the application, which by default should be configured to send email through the JumpBox.
Note: It also appears that using Gmail always sets the sender to be the Gmail username which could be confusing under certain circumstances.
Note: If you have other problems with email delivery, please see our General Email FAQ.