I wanted to post a shortcut for anyone trying to configure their system to send the voicemail emails to a smart host with authentication. As a general linux newbie I've been struggling with this for weeks now, and finally found a solution that, hopefully, will help someone else from additional hair loss, general malfeasance and grumpy moods...
Most Linux distro's come out of the box with sendmail enabled, which is great if:
A. you know how to work with it
B. the asterisk exists in a fully happy domain with good MX records
sendmail is way overkill for a usual dedicated asterisk installation.
If you are a sendmail expert and have all DNS straight, and this asterisk is also at a static address, then it is pretty much plug and play. If this asterisk is out somewhere on a broadband circuit, and its IP address changes all the time, it is better to have it act as a SMTP client, authenticate, and have an external mail server take care of everything remote.
If you don't know anything about what I just said, then you're about as dumb as I am, a phone guy that now has to become a sys admin. So bypass all that BS, load exim.
0. Before you start, get an external mailserver somewhere, anywhere, but go the extra mile and make sure it has a static (never changing) IP address that you can reach. This is important, exim (from what I can tell) needs to use an IP address for this setup as opposed to a domain name.
Maybe you have one already, to find its address, do:
nslookup mail.myprovidersdomain.com
or
smtp.myprovidersdomain.com
or whatever.
1. Get and install exim if you don't have it:
(all this is done as su/root)
yum install -y exim
the system will install and show COMPLETE! at the end
2. Turn off sendmail:
service sendmail stop
3. Edit the voicemail.conf file. Comment out the sendmail line in case you want to use it again someday. Insert the user (from:) email address you want to show the world when asterisk sends an email in place of user@domaintoshow.com.
; mailcmd=/usr/sbin/sendmail -t -f user@domaintoshow.com
mailcmd=/usr/sbin/exim -t -f user@domaintoshow.com
Disregard any other lines of this file.
4. Modify exim config, on RH/CentOS it should be /etc/exim/exim.conf. Modify or add the following lines:
primary_hostname = yourbox.yourdomain.com
domainlist local_domains = yourdomain.com
Now find this line farther down in the config:
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
Comment out this line so it looks like:
# dnslookup:
# driver = dnslookup
# domains = ! +local_domains
# transport = remote_smtp
# ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
# no_more
Then add this line below:
divertnonlocal:
driver = manualroute
domains = ! +local_domains
transport = remote_smtp
route_list = * 192.168.0.6
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
Replace "192.168.0.6" with your SMTP relay host (your mailerver's static IP/smarthost destination).
5. Find this line afterwards:
remote_smtp:
driver = smtp6.)
Change it to:
remote_smtp:
driver = smtp
hosts_require_auth = 192.168.0.6
hosts_try_auth = 192.168.0.6
Change "192.168.0.6" to your smarthost server.
6. At the bottom of the file, find this line:
begin authenticators
Below this, add:
login:
driver = plaintext
public_name = LOGIN
client_send = ": user@yourprovidersdomain.com : password"
Replace "user@yourprovidersdomain.com" with SMTP Auth username. "password" with your SMTP Auth password.
Disregard any other lines of this file.
7. Restart asterisk:
service asterisk restart
8. Start exim:
service exim start
9. You can monitor exim's activity at /var/log/exim/main.log
almost forgot, make it last by:
chkconfig --add exim
chkconfig --del sendmail