For the past year to 2 years, I have had this issue where asterisk would not send emails out when voicemails were left. The strange thing was that it only worked when I started asterisk manuallyÂ from command lineÂ but it wouldÂ not work correctly when run from any startup or boot script. After looking into the problem more deeply did I realize that esmtp does not run as root when called by asterisk unless asterisk was first started by root.Â The example belowÂ is the only way ive found to get asterisk to send emails without killing the application first and starting itÂ manually through theÂ console as a root user every time I rebooted the device.
In your voicemail.conf file use the line below to get asterisk to run esmtp as root even when started by a boot script. Be sure to replace the exact directory location of esmtp/sendmail with yours.
You could also replace the command with the sendmail equivalent since esmtp mimics sendmail to a certain degree.Â TheÂ command I listed isntÂ rocket science, but i just didnt know enough about linux to actually implementÂ it correctly in the voicemail.conf file. Hopefully this helps someone figure out why asterisk willÂ not send emails with the voicemail as an attachmentÂ unless run manually via command line and not by a boot script.