Sendmail Setup

So, "Why do you need to set up sendmail on a telephone switch," you ask? Its a good question. The short answer is that the voicemail application will send you an email notification (with the voicemail attached), whenever a caller leaves you a message. Its worth it for just that feature alone.

But, you may also want to monitor the status of the switch's attached UPS with NUT and send yourself email when a problem occurs. Other monitoring applications can also take advantage of sendmail to send email when certain events happen. Consequently, setting up sendmail makes good sense.

We're assuming that your Asterisk switch is a local machine and that it will deliver mail via your main mail server. You need to hack sendmail.mc on the Asterisk switch and then restart its local sendmail. Uncomment the SMART_HOST line in the macro file (probably /etc/mail/sendmail.mc) and aim it at your main mail server:

     define(`SMART_HOST',`jump-gate')

Rebuild the sendmail.cf file:

     /usr/bin/m4 sendmail.mc >sendmail.cf

Restart sendmail:

     /etc/rc.d/init.d/sendmail stop
     /etc/rc.d/init.d/sendmail start

You should now be able to send mail to the main mail server from the local machine (if relaying is denied, you may need to add the local machine's address to relay-domains on the main mail server). You might want to alias the following users in /etc/aliases on the local machine:

     root: joeblow@mydomain.com

As long as the aliased name contains a domain name, it will be forwarded by the local sendmail to the SMART_HOST. If the domain name is marked as a local domain on the main mail server, the mail will get delivered there. Note that you need to recycle sendmail on the local machine when you add aliases to /etc/aliases.