Setting up dotCMS mail for sendmail on CentOS

This quick tutorial explains how to set up dotCMS to send email on a CentOS server. By default, dotCMS is configured to use localhost for sending emails. The configuration happens in tomcat/conf/Catalina/localhost/ROOT.xml:

<Resource name="mail/MailSession" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost" />

So that's perfect. Now we just need to make sure that sendmail is installed and running for dotCMS to connect to.

CentOS should already have sendmail installed, but if not, we can install it with yum:

sudo yum install sendmail

You can then start up the sendmail service:

sudo service sendmail start

We want to make sure that sendmail will start up on it's own if the server reboots, so we run the following:

chkconfig sendmail on

You can confirm that it worked by listing the configuration:

chkconfig --list sendmail

You should see this:

sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off

The following table explains the run levels listed by chkconfig:

Run Level Action
0 System halt
1 Single-user mode for administrative tasks
2 Multi-user mode without network interfaces or daemons
3 Normal system start
4 Not used/user-definable
5 Normal system start with desktop (GUI)
6 Reboot

That's it! You can now send emails. Here's some example velocity for sending email:

    <p>The email sent successfully to recipient@example.com!</p>

Say Hello

Near the Cleveland, Akron or Medina area and want to stop by our office? Let us know and we'll get the coffee and whiteboards ready. :)