Sendmail configuration

The following stages are required to configure sendmail integration:

  • Install sendmail if needed
  • Enable manual sendmail configuration
  • Add Jiglu mailer to sendmail configuration file
  • Add Jiglu milter to sendmail configuration file
  • Enable mailertable and access features in sendmail configuration file
  • Add Jiglu mailer to mailertable
  • Add Jiglu domain to access table
  • Compile the sendmail configuration file and rebuild databases
  • Restart sendmail
  • Test configuration

Not all these stages will necessarily be required, depending on the Linux distribution and the integration required.

Install sendmail if needed

Sendmail may not be the default MTA on some Linux distributions. To install it on OpenSuse use:

zypper install sendmail sendmail-devel

When prompted, you should choose the option to remove Postfix.

On Amazon Linux you will need to install the configuration and milter packages:

yum install sendmail-cf sendmail-milter

Enable manual sendmail configuration

In OpenSuse it will be necessary to edit /etc/sysconfig/mail to disable automatic generation of the sendmail configuration file and to enable outside connections.

Change MAIL_CREATE_CONFIG to "no" and SMTPD_LISTEN_REMOTE to "yes".

Add jiglu mailer

Jiglu uses a sendmail mailer definition to have sendmail forward on messages to the /opt/jiglu/sbin/queuemail executable. This is a tiny program written in C that will take an incoming message on stdin and write it to the Jiglu incoming mail spool file.

The Jiglu RPM installs the mailer definition file in both the /usr/share/sendmail/mailer and /usr/share/sendmail-cf/mailer directories. In OpenSuse the former directory will be used, in Fedora, Redhat, Amazon Linux and similar distributions the latter will be used.

In OpenSuse the sendmail definition file will be /etc/mail/linux.mc, in Fedora, Redhat and Amazon Linux it will be /etc/mail/sendmail.mc. To enable sendmail to use the Jiglu mailer, add the following to the end of the sendmail definition file:

MAILER(`jiglu')dnl

Note that in sendmail definitions the first tick is a backtick and the second an apostrophe.

Add Jiglu milter

If the Jiglu mailer was used on its own then if you sent a message to an address on the Jiglu domain that did not exist it would be necessary for sendmail to receive it in full, forward it on to Jiglu and then Jiglu would need to return a message to the sender saying the address could not be found. Instead when the connection is first made to sendmail, sendmail can ask Jiglu if it knows about the address using a milter. To enable this, add the following to the end of the sendmail definition file:

INPUT_MAIL_FILTER(`jiglufilter', `S=inet:25000@localhost, T=C:20s;S:10s;R:15s;E:30s')

There are some additional settings in the bootstrap.properties configuration file to control milter usage, including using it to reject messages from senders that are unknown by the Jiglu system.

Enable mailertable and access features

Jiglu makes use of the mailertable feature to route messages for the Jiglu mail domain to the Jiglu mailer. In OpenSuse this feature is enabled by default. In Fedora, Redhat, Amazon Linux or similar distributions make sure that the following line exists or is uncommented in the sendmail.mc file:

FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl

Jiglu also needs sendmail to know that it handles mail for this domain using the access table feature. Make sure that the following line exists or is uncommented in the linux.mc or sendmail.mc file:

FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl

Add Jiglu mailer to mailertable

Sendmail now needs to know how to route messages for the Jiglu domain to the Jiglu mailer. Edit the file /etc/mail/mailertable and add the following line:

jiglu.example.com jiglu:default

Replacing jiglu.example.com with the domain name used by the system, as set in the com.jiglu.mail.domain property in bootstrap.properties.

Add Jiglu domain to access table

Sendmail also needs to know that it is responsible for access to the Jiglu domain. Edit the file /etc/mail/access and ad the following line:

jiglu.example.com RELAY

Again replacing jiglu.example.com with the domain name used by the system, as set in the com.jiglu.mail.domain property in bootstrap.properties. Note that this domain should not appear in /etc/mail/local-host-names or sendmail will consider it used for local users that exist on the machine.

Compile the sendmail configuration file and rebuild databases

The sendmail definition file needs to be compiled into the form used by sendmail before it can be used. The databases also needs to be built.

In OpenSuse use:

m4 /etc/mail/linux.mc > /etc/sendmail.cf
make

In Fedora, Redhat or Amazon Linux instead use:

/etc/mail/make

Restart sendmail

To restart sendmail, in OpenSuse use:

systemctl restart sendmail

In Fedora, Redhat or Amazon Linux instead use:

service sendmail restart

Test configuration

To check that everything is configured correctly, you can ask sendmail to confirm how it will deliver messages to the Jiglu domain. Enter:

/usr/sbin/sendmail –bv (Address removed)

Again replacing jiglu.example.com with the domain name used by the system, as set in the com.jiglu.mail.domain property in bootstrap.properties. You should get a result similar to the below:

(Address removed)... deliverable: mailer jiglu, host jiglu, user (Address removed)
Written by Stephen Hebditch. Published on .
4.0.0
How to integrate Jiglu with the sendmail MTA.