Here is how you can make asterisk use GMAIL to send voicemails
Tested on Issabel distro on Asterisk 16.6.1
1> Login to your Gmail Account (via browser)
You will probably receive some google alerts that this is been set.
3> Install POSTFIX
yum -y install postfix mailx cyrus-sasl-plain
4> Edit the password file and put in your gmail credentials.
You can use VI or NANO (install instructions for nano below)
/etc/postfix/sasl_passwd
If you aren't familiar with Vi, you can install NANO using the following
command
yum install nano
Put in the following information, alter it with your credentials for
gmail. This file is going to be encrypted after a successful test so dont
worry about your credentials being stored in clear text, it is only for a few
minutes.
smtp.gmail.com
GMailUserName@gmail.com:GMailPassword
5> Now we hash (encrypt) the password file so that it can't be
stolen.
postmap hash:/etc/postfix/sasl_passwd
6> Edit the file /etc/postfix/main.cf
Paste in the information below and save
smtp_sasl_auth_enable = yes
relayhost = smtp.gmail.com:587
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
7> Reload the mail service
smtp.gmail.com
GMailUserName@gmail.com:GMailPassword
8> Send a test message from the CLI
[root@issabel asterisk]# mail SomeEmailAccount@domain.com
Subject: This is an email test
This is a test.
.
If everything worked correctly, you SHOULD get an email to the email
account you used via your Gmail Account
If NO email showed up, you can look at the mail log /var/log/maillog
Sep 2 1:20:45 issabel postfix/pickup[50041]: AAD341428DC: uid=0 from=<root>
Sep 2 1:20:45 issabel postfix/cleanup[50295]: AAD341428DC: message-id=<20191129142045.AAD341428DC@issabel.local>
Sep 2 1:20:45 issabel postfix/qmgr[50042]: AAD341428DC: from=<root@issabel.local>, size=427, nrcpt=1 (queue active)
Sep 2 1:20:45 issabel postfix/smtp[50297]: connect to smtp.gmail.com[2607:f8b0:400d:c0e::6c]:587: Network is unreachable
Sep 2 1:20:47 issabel postfix/smtp[50297]: AAD341428DC: to=<SomeEmailAccount@domain.com>, relay=smtp.gmail.com[209.85.144.109]:587, delay=1.9, delays=0.05/0.04/1/0.74, dsn=2.0.0, status=sent (250 2.0.0 OK 1575037247 o70sm10311267qke.47 - gsmtp)
Sep 2 1:20:47 issabel postfix/qmgr[50042]: AAD341428DC: removed
9> Now delete the original file that contained your clear text
password.
rm /etc/postfix/sasl_passwd
10> Now you can go into the system and add the email addresses to
your voicemail accounts.