{"id":606,"date":"2011-04-13T21:48:54","date_gmt":"2011-04-14T05:48:54","guid":{"rendered":"http:\/\/www.adrianandgenese.com\/blogger\/?p=606"},"modified":"2011-04-13T22:03:09","modified_gmt":"2011-04-14T06:03:09","slug":"asterisk-and-esmtp-not-working-unless-first-run-from-console","status":"publish","type":"post","link":"http:\/\/www.adrianandgenese.com\/blogger\/2011\/04\/13\/asterisk-and-esmtp-not-working-unless-first-run-from-console\/","title":{"rendered":"Asterisk and esmtp (or sendmail) not sending voicemail emails unless first run manually from console"},"content":{"rendered":"<p>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\u00c2\u00a0from command line\u00c2\u00a0but it would\u00c2\u00a0not 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.\u00c2\u00a0The example below\u00c2\u00a0is the only way ive found to get asterisk to send emails without killing the application first and starting it\u00c2\u00a0manually through the\u00c2\u00a0console as a root user every time I rebooted the device.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.adrianandgenese.com\/blogger\/wp-content\/uploads\/2011\/04\/root-user.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-thumbnail wp-image-620\" title=\"root user\" src=\"https:\/\/i0.wp.com\/www.adrianandgenese.com\/blogger\/wp-content\/uploads\/2011\/04\/root-user.png?resize=150%2C150\" alt=\"\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/www.adrianandgenese.com\/blogger\/wp-content\/uploads\/2011\/04\/root-user.png?resize=150%2C150 150w, https:\/\/i0.wp.com\/www.adrianandgenese.com\/blogger\/wp-content\/uploads\/2011\/04\/root-user.png?w=250 250w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>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.<\/p>\n<p style=\"padding: 2px 6px 4px 6px; color: #555555; background-color: #eeeeee; border: #dddddd 2px solid;\">\u00ef\u00bb\u00bfmailcmd=su -c &#8220;\/opt\/bin\/esmtp -t -f your@email.com&#8221;<\/p>\n<p>You could also replace the command with the sendmail equivalent since esmtp mimics sendmail to a certain degree.\u00c2\u00a0The\u00c2\u00a0command I listed isnt\u00c2\u00a0rocket science, but i just didnt know enough about linux to actually implement\u00c2\u00a0it correctly in the voicemail.conf file. Hopefully this helps someone figure out why asterisk will\u00c2\u00a0not send emails with the voicemail as an attachment\u00c2\u00a0unless run manually via command line and not by a boot script.<\/p>\n<div id=\"wp_fb_like_button\" style=\"margin:5px 0;float:none;height:100px;\"><script src=\"http:\/\/connect.facebook.net\/en_US\/all.js#xfbml=1\"><\/script><fb:like href=\"http:\/\/www.adrianandgenese.com\/blogger\/2011\/04\/13\/asterisk-and-esmtp-not-working-unless-first-run-from-console\/\" send=\"true\" layout=\"standard\" width=\"450\" show_faces=\"true\" font=\"arial\" action=\"like\" colorscheme=\"light\"><\/fb:like><\/div>","protected":false},"excerpt":{"rendered":"<p>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\u00c2\u00a0from command line\u00c2\u00a0but it would\u00c2\u00a0not work correctly when run from any startup or boot script. After looking into the problem [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[25,20],"tags":[61,145,94,143,148,147,97,146,144],"class_list":["post-606","post","type-post","status-publish","format-standard","hentry","category-computers","category-hack","tag-asterisk","tag-attachment","tag-email","tag-esmtp","tag-permissions","tag-root","tag-sendmail","tag-su","tag-voicemail"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/preRH-9M","_links":{"self":[{"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/posts\/606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/comments?post=606"}],"version-history":[{"count":14,"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/posts\/606\/revisions"}],"predecessor-version":[{"id":622,"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/posts\/606\/revisions\/622"}],"wp:attachment":[{"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/media?parent=606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/categories?post=606"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.adrianandgenese.com\/blogger\/wp-json\/wp\/v2\/tags?post=606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}