Using Gmail Email Accounts to Send Automated Emails or Voicemail to Email Asterisk
Recently Google updated some of its security settings so the tutorial I created around doing Asterisk Voicemail to Email is broken when a new setting is enabled. Lucky for everyone looking to use a Gmail account I have created this new post to help you.
If you would like to read about this new setting here is a link: https://support.google.com/accounts/answer/6010255?hl=en
The first thing you will want to do is login to the gmail account you plan on using for voicemail to email. Once you have done that follow the directions below.
Follow along below for your Asterisk voicemail to email with a Gmail account using the postfix application.
1. Visit the following URL to enable less secure apps: http://www.google.com/settings/security/lesssecureapps
2. We do need to install a couple of extra packages even if postfix is already installed. I also am installing postfix just in case you didn’t have it installed.
yum -y install postfix mailx cyrus-sasl-plain
3. You need to create a new file with your Gmail account smtp server and credentials in the following format.
Paste in the below text and change the email address to your gmail email and enter in your password.
4. Once done doing that we want to hash your password file so it is not human readable.
5. The next step is to configure postfix to use this new password file. Open the /etc/postfix/main.cf file using a text editor then scroll down to the bottom and paste in the following code.
smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous # Secure channel TLS with exact nexthop name match. smtp_tls_security_level = secure smtp_tls_mandatory_protocols = TLSv1 smtp_tls_mandatory_ciphers = high smtp_tls_secure_cert_match = nexthop smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt relayhost = smtp.gmail.com:587
6. Restart the postfix service.
service postfix restart
7. Now you can send a test email using the mail command in the following format.
mail firstname.lastname@example.org Subject: Hello World . (followed by enter key to send and exit) EOT
8. Once you send that check your email to see if you received the email and as long as that is the case you can go ahead and remove the text password file.
9. Now you are all set, by default Asterisk will use the default mailing program so my voicemail.conf file looks like so.
[root@localhost ~]# cat /etc/asterisk/voicemail.conf [general] format = wav serveremail = asterisk attach = yes skipms = 3000 maxsilence = 10 maxmessage = 300 review = yes silencethreshold = 128 maxlogins = 3 emaildateformat = %A, %B %d, %Y at %r sendvoicemail = yes exitcontext = vm-operator operator = yes fromstring = PBX Voicemail
Hope you find this helpful and it works for you. Please let me know if there are any issues so I can correct my tutorial. I like my visitors to get their questions answered with a single visit, not having to bounce around from website to website trying to solve a problem.