1

I use Ubuntu 16.04 with Bash, Nginx, and sSMTP. On this environment I have 2 or more WordPress apps.

The basic configuration of sSMTP allows it to route WordPress contact form emails from one app, into my personal email account (Gmail).

sudo cat /etc/ssmtp/ssmtp.conf:

root=MY_GMAIL_ADDRESS@gmail.com
mailhub=smtp.gmail.com:587
UseTLS=YES
UseSTARTTLS=YES

AuthUser=MY_GMAIL_ADDRESS@gmail.com
AuthPass=___MY_GMAIL_PASSWORD___

rewriteDomain=gmail.com
hostname=alien
FromLineOverride=YES

My question

In case I have 2 or more apps, how should the sSMTP conf be reconstructed when the Ubuntu user has 2 or more apps?

Update

In your answer, please also refer to the issue of security. Putting my personal Gmail password exposed in a config file seems like a security risk, not something I want to do. On the other hand, I don't want to create a second Gmail account, or I must and should shut up and do so?...

  • @SebastianStark I expect to be able to use a single sSMTP conf for 2 apps or more, instead just one. When I read the above configuration I say to myself "The root, AuthUser and AuthPass all fit for 1 account, but what if I have multiple accounts to send mail to?". – JohnDoea Mar 14 '18 at 20:16
  • Don't forget to change the hostname from alien to whatever echo $HOSTNAME reveals. Expanding on Sebastian's point about root, if someone types the sudo password wrong root will get an email. If a cron job fails root will get an email, etc. – WinEunuuchs2Unix Mar 14 '18 at 22:41
3

Generally, there is no need to change your ssmtp configuration. If you want to stick to your single gmail account you could maybe use the + extension feature, where you can extend your gmail address by adding +something to the part before @gmail.com.

This way you get all the emails in your gmail account but you can tell them apart by the bit you added after the +. (more information here).

But you could also just choose to configure any other email address in wordpress.

Security

As for the security aspect of this: If you can avoid putting your very personal email account password in a system file in cleartext, especially on a system running wordpress (has quite a history of being hacked), it would be much better. You have several choices here (most of which would deviate too much from the original topic of this question):

  1. Simply create another Gmail account that you use only for this purpose: authenticating an smtp session for ssmtp. You will still be able to send emails to your regular gmail account, but not have to put its valuable password in the config file.

  2. Setup and configure an smtp server on your machine.

  3. Another option would be to check if your provider (the one where your wordpress server is located) offers an smtp server. Normally this does not even need smtp authentication to be set up. That would be the preferred option in my opinion.

  • Typically I use Carbon Copy (yes they had those in Grade 2!) aka CC: to send to more than one address. I've always been weak on networking but I think ssmtp can be considered the topology or network layer and wordpress (or whatever) can be considered the application layer that inserts the CC: address. – WinEunuuchs2Unix Mar 15 '18 at 1:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.