Dispo Call Url & Gmail Postfix Relaying

Any and all non-support discussions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Dispo Call Url & Gmail Postfix Relaying

Postby thephaseusa » Wed Feb 21, 2018 4:34 pm

Version: 2.14b0.5
SVN Version: 2872
DB Schema Version: 1527
ViciBox v.7.0.4| Asterisk 11.25.1-vici |
4 Box Cluster of 1 Database, 1 Asterisk, 1 Web, & 1 Archive Server.
Fundraising Call Center

I worked on getting emails working on call dispo some time ago. It’s a superb feature. In my use of vicidial we have sales calls where its useful to email a prospect a letter and then call them back later. I didnt want to send every call back an email so I created a custom disposition called Email Letter & Call Back. I have been pulling these directly from the asterisk database and manually emailing because I wasn’t able to get it working how I wanted with gmail. I have gmail accounts for my sales campaigns, and use them to send letters and invoices. And they work fine using Firefox. But when i tried sending from vicidial google first complaining about “improper or invalid relaying”. So I configured the email to relay through my internet provider, charter.net. This worked. However, if I used the gmail from address, the emails would send and arrive in inboxes correctly, but with a warning that “this email may not have been sent by gmail” or something. Obviously that wouldn’t look good. I tried using a different email from address and that worked fine, but it isn’t the real gmail address. Further I thought of using a do not reply type email and typing in caps please do not reply to this email etc but I didnt feel good about that either.

Recently I am starting to feel that this dispo call url send email feature is something I really need. One or two emails is fine, but if it builds up to a 100 or more a day, it would be really cool if vicidial could send out all those emails itself. In my business we have been a one call close type of business. I’m seeing more and more though now of customers insisting on seeing something in writing before they fulfill. So in many cases we call them, email them a letter, and call them a second time to close them. What is the most practical solution? Should I set up an email server and create new email addresses to use? Or is there something I am missing in configuring with gmail?

Still Grinding,
John M
Last edited by thephaseusa on Sun Mar 04, 2018 7:12 pm, edited 2 times in total.
thephaseusa
 
Posts: 345
Joined: Tue May 16, 2017 2:23 pm

Re: Dispo Call Url & Gmail Config Problems

Postby williamconley » Wed Feb 21, 2018 6:12 pm

While this forum is directly related to your problem: Your problem is one of "how to get postfix to send through gmail", which is not actually a vicidial function at all.

You have a couple possible paths for this:
* Have your dispo_url use a php method to contact gmail direct and send the email via php. PHP help forums will walk you through a php connection to gmail.
* Have your dispo_url use a php method to push the mail to the local postfix mail service, then configure postfix to send through gmail. Now you'll be looking at finding help with postfix and how to properly relay through gmail.

In both cases, you'll need to use the gmail ports (not 25) that allow user/pass authentication so you are accessing their system as a User and not trying to use them as an open relay. If you fail to find instructions for this, let me know. Blackbird may pop on and put in an example if you get very lucky. But if not: configuration options are readily available for both methods.

Note that "offloading" the process to postfix will likely reduce server load. Apache will no longer have to wait for completion, it'll get an immediate "offload" satisfaction and the postfix system will take over to slowly but surely manage the email.

By slowly, I refer to nanoseconds and the "sometimes necessary" delay while servers connect with each other ... a few seconds delay is not something apache/php appreciates while dispo_url is awaiting a response. This gets it off the apache load immediately if you use the local postfix server.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Dispo Call Url & Gmail Config Problems

Postby thephaseusa » Wed Feb 21, 2018 6:58 pm

Thanks William! I think I’ll try path #2. Blackbird helped me recently with another question. God bless you guys for the support you give on this forum!

William when you say push the mail to postfix, will the file dispo_send_email.php do that, and then I just need to configure postfix so it can use gmail as a mail relay?
John M
thephaseusa
 
Posts: 345
Joined: Tue May 16, 2017 2:23 pm

Re: Dispo Call Url & Gmail Config Problems

Postby blackbird2306 » Sun Mar 04, 2018 7:02 am

I've read in another post that you were now able to configure postfix with GMAIL. Please post here all your steps as a guide to help other people. This question has already come several times
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.12-560a build: 160617-1427 | Asterisk 1.8.32.3
blackbird2306
 
Posts: 409
Joined: Mon Jun 23, 2014 5:31 pm

Re: Dispo Call Url & Gmail Config Problems

Postby thephaseusa » Sun Mar 04, 2018 6:10 pm

Version: 2.14b0.5
SVN Version: 2872
DB Schema Version: 1527
ViciBox v.7.0.4| Asterisk 11.25.1-vici |
4 Box Cluster of 1 Database, 1 Asterisk, 1 Web, & 1 Archive Server.

Here is a guide for configuring gmail relaying so the dispo_send_email.php will work with gmail addresses on Vicidial:

Required Software

zypper update && zypper install postfix mailx cyrus-sasl
or with a standard vicibox install you should be able to just run:
zypper install cyrus-sasl

Configure Gmail Authentication
vi /etc/postfix/sasl_passwd
Add the line:
[smtp.gmail.com]:587 username@gmail.com:password
Save and close the file. Your Gmail password is stored as plaintext, so make the file accessible only by root:
# chmod 600 /etc/postfix/sasl_passwd

Configure Postfix
Edit the main Postfix configuration file:
vi /etc/postfix/main.cf
Add or modify the following values:
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/ca-bundle.pem
Save and close the file.

OpenSUSE also requires that the Postfix master process configuration file master.cf be modified. Open it for editing:
vi /etc/postfix/master.cf
Locate the line which reads:
#tlsmgr unix - - n 1000? 1 tlsmg
Uncomment it, so it reads:
tlsmgr unix - - n 1000? 1 tlsmg
Save and close the file.

Process Password File
postmap /etc/postfix/sasl_passwd

Restart Postfix
systemctl restart postfix.service

Enable "Less Secure Apps" In Gmail
By default, only the most secure sign-ins, such as logging in to Gmail on the web, are allowed for your Gmail account. To permit relay requests, log in to your Gmail account and turn on Allow less secure apps.

Send A Test Email
Test your new configuration by sending an email using the mail command. Run:
mail -s "Test subject" recipient@domain.com
You will be presented with a blank line (or a CC: field, which you can bypass by pressing Enter). Type the body of your message, pressing Enter for new lines. When you are finished composing the email, type CTRL-D to send it. To cancel the email, press CTRL-C twice.

Troubleshooting
journalctl

I use journalctl -f to watch the process when the dispo send email is triggered. It will show you if it found the gmail server, and if the email was sent, or if there is a permission or password or other error.

For those of you not running OpenSUSE here is the full guide, which has instructions for other OS's also:
https://www.howtoforge.com/tutorial/con ... ail-relay/

John M
thephaseusa
 
Posts: 345
Joined: Tue May 16, 2017 2:23 pm


Return to General Discussion

Who is online

Users browsing this forum: Bing [Bot] and 39 guests