cloudnine
By:
cloudnine

How to make a droplet send email?

July 26, 2014 3.7k views

Hi,

I have installed CSF as the firewall for my droplet by following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-config-server-firewall-csf-on-ubuntu

Now, in the sub-heading called Process Tracking, it says that CSF can be configured to send emails to the system admin about the various firewall processes. My questions are:

  1. Where do I add the system admin email id?
  2. I have CentOS with MySQL, PHP, Apache running. Will this automatically ensure system emails being sent out or do I need to add some email system?

Thanks in advance.

4 Answers

Edit /etc/csf/csf.conf and set LF_ALERT_TO to your email address:

LF_ALERT_TO = "your@email.address"

and restart CSF:

csf -r

Make sure you have a mail transfer agent installed such as sendmail or postfix:

sudo yum remove sendmail
sudo yum install postfix

Edit /etc/postfix/main.cf and set inet_interfaces to loopback-only:

inet_interfaces = loopback-only

and finally, restart postfix:

sudo service postfix restart

@Kamal Nasser, thank you for your clear instructions, down to the specific commands to use. Believe it or not, this issue was a deal breaker for me when I got a Linode VPS. So, this is a win for DO, thank you, once again.

As for sendmail and postfix, I assume the following:

  • That you are suggesting removal of sendmail as it's complex for a newbie
  • Restricting to loopback_only is for preventing open mail relays

Also, after installing Postfix, do I need to install Dovecot?

  • No problem!

    That you are suggesting removal of sendmail as it's complex for a newbie

    Using sendmail is perfectly fine. I'm just used to Postfix and prefer it over sendmail (e.g. sendmail has a hardcoded 30 second sending delay that is applied if your hostname isn't a FQDN). Since you haven't mentioned anything about email, I thought it would be fine if you replaced sendmail with postfix :)

    Restricting to loopback_only is for preventing open mail relays

    That's correct :)

    Also, after installing Postfix, do I need to install Dovecot?

    You don't need to install Dovecot since you're not hosting mail on the server itself. Dovecot is simply a way to remotely grab your mail via IMAP or POP3.

Thanks, again. I will go with Postfix. As for Dovecot, I am planning to test a ticketing system on the droplet. Now, the actual mailboxes used for the tickets are hosted elsewhere, but an application on the droplet will pull in email from those mailboxes through IMAP and present them in the application's web interface. I guess this means Dovecot would be required?

As for loopbackonly, I found the following enabled in the Postfix config file:
inet
interfaces = localhost

Is this the same as loopback_only?

  • If the mailboxes are hosted externally, you won't need Dovecot. Your app would just connect to the remote IMAP server just like a desktop email client.

    Is this the same as loopback_only?

    Yes.

@ Kamal Nasser, I would like to thank you once again for taking the time to answer my follow-up questions.

I really do appreciate your assistance.

Have another answer? Share your knowledge.