[asterisk-users] sendmail

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sun Dec 20 12:30:41 CST 2009


On Sun, Dec 20, 2009 at 06:38:54PM +0100, meetmecall wrote:
>
> I used msmtp for delivering mail and this is the procedure I documented 
> once, based on info I found on the internet. I hope it is of help.
>
>
> Erik
>
> Step 1  Installing needed packages/libs on your system
>
> install this packages (I'm not sure if all the packages are needed but  
> with this packages it works)
>
>  apt-get install libwww-perl
>  apt-get install openssl
>  apt-get install libcrypt-ssleay
>  apt-get install libnet-ssleay-perl
>  apt-get install libcrypt-ssleay-perl
>
>
> Step 2  download msmtp
>
> download msmtp van sourceforge (http://sourceforge.net/projects/msmtp/) 
> to /usr/src/
>
> Step 3
>
> bunzip2 msmtp.tar.bz2
>
> tar -xvf msmtp.tar
> cd  /usr/src/msmtp[tab]
>
> Step 4
>
> built msmtp
>
> ./configure
> make
> make install
>
>
> Step 5
>
> check if msmtp is on the system and if the output looks like below.
>
> # msmtp --version
>
> msmtp version 1.4.9
> TLS/SSL library: GnuTLS
> Authentication library: GNU SASL
> Supported authentication methods:
> plain cram-md5 digest-md5 gssapi external login
> IDN support: enabled
> NLS: enabled, LOCALEDIR is /usr/share/locale
> System configuration file name: /etc/msmtprc
> User configuration file name: /root/.msmtprc
>
> Copyright (C) 2006 Martin Lambers and others.
> This is free software.  You may redistribute copies of it under the  
> terms of
> the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
> There is NO WARRANTY, to the extent permitted by law.

Alternatively: 

  aptitude install msmtp

Try also:

  dpkg-reconfigure msmtp

to reconfigure it.

>
> Step 6
> Make a symlink from /usr/local/bin/msmtp to /usr/sbin/sendmail  (the  
> name of the symlink is sendmail)
>
> #  ln -s /usr/local/bin/msmtp /usr/sbin/sendmail
>
> Step 7
> Add /root/.msmtprc (be aware of the dot) to the system with only owner  
> read and write permissions and with this lines (adjust to your 
> xxxx at gmail.com account).  This way it works for a gmail account

Asterisk running as root?

>
>
> defaults
> logfile /var/log/msmtp.log
>
> account default
> from <xxxxxx>@gmail.com
> protocol smtp
> host smtp.gmail.com
> port 587
> user <xxxxxxx>@gmail.com
> password <password>
> auth on
> tls on
> tls_certcheck on
> tls_trust_file /root/cert.pem
>
>
>
> Step 8  certificate file
>
> copy the certificate file to the root directory
> /root/cert.pem copied on system  (see attachement)

Why would you mess with that? Why would you need a worthless
(self-signed) certificate?

>
>
> Step 9 configuration of /etc/asterisk/voicemail.conf
>
> Add this to /etc/asterisk/voicemail.conf as a replacement of the  
> "mailcmd =" line
> mailcmd=/usr/sbin/sendmail -v -t -f <your_gemail_name>@gmail.com
>
> and uncomment  "attach = yes
>
> Add a vociemailbox to the system in [default] of voicemail.conf
>
> [default]
> ; Define maximum number of messages per folder for a particular context.
> ;maxmsg=50
>
> 500 => 1234,<name>,<e-mail adress>
>
> step 10 adding a test extension to the system
>
> Add an extension to /etc/asterisk/extension.conf to test de setup
>
> something like
>
> exten => 888,1,Answer()
> exten => 888,n,Voicemail(500)
>
> If you call 888 with in internal phone you enter the voicemail routine  
> and a recording will be made. After finishing you will receive an e-mail 
> with the recording as an attachement.
>
>
> And you are done
>
> On 20 dec 2009, at 11:51, James Stocks wrote:
>
>> On 19 Dec 2009, at 16:20, Thomas Perron wrote:
>>
>>> Anyone have a cookbook on configuring sendmail to work with Asterisk?
>>> Or,a few config examples.
>>

>> Postfix is a drop-in replacement for sendmail.  I find it to be far,  
>> far simpler to administer.

Let's abuse the fact that someone overquoted to demonstrate that. Though
this is untested.


aptitude install postfix
cat <<EOF >>/etc/postfix/main.cf
relayhost = relayhost = [smtp.gmail.com]:587

# The following options set parameters needed by Postfix to enable
# Cyrus-SASL support for authentication of mail servers.
#
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

# TLS client support:
# see /usr/share/doc/postfix-tls/html/conf.html
smtp_use_tls = yes
smtp_tls_CApath = /etc/ssl/certs/
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
smtp_tls_security_level = may
EOF

echo 'smtp.gmail.com <xxxxxx>@gmail.com <passworda>' >/etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
/etc/init.d/postfix reload

echo testing, 1, 2 3 | mail -s test xxxxxxx at example.net


-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list