Wednesday, February 6, 2019

Issabel EMAIL configuration and integration with vTiger

Currently this document outlines how to send email within the server itself.
This documents intended audiences are users trying to make asterisk send email to Vtiger

This has been tested on ISSABEL ditro of asterisk and the GA release of FreePBX Distro January 2019

Not covering relays to send email externally

PBX server host name is issabel
Company domain is company.com

In ISSABEL GUI

Under EMAIL -DOMAIN - CREATE DOMAIN

issabel.company.com

Save changes

EMAIL - ACCOUNTS - select domain (issabel.company.com)
create account  "admin"

Save changes

Should see something like  "admin@issabel.company.com"

Create another user to be the email tickets are sent to "ticket@issabel.company.com"

In ISSABEL - EMAIL - webmail

IF you see the error something like this show up:
This error is caused by the installation of VTIGER onto the box.  Some PHP settings it requires causes this.
" Strict Standards: Non-static method PEAR::setErrorHandling() should not be called statically in /var/www/html/mail/program/include/iniset.php on line 133 "
Well, truth is i'm not sure how to fix it at time of writing. But a work around that seems to not have any problems is to comment out the very last line of the file iniset.php by adding " // " in front of it.
The edit would look like this.  Save your changes.
//PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');

Click on WebMail again.
If you had to make the above correction you should see that error gone.

Logging into webmail, user = admin@issabel.company.com
you probably will need to use the whole user@domain

See if you can send email between user "admin" to user "ticket".
It depends on your domain configs, sometimes the email dies.  If you don't seem to be getting emails check the "FAILED EMAIL" section at the bottom of this document for some hints.

Test.  Should be able to send email back and forth using the WEBMAIL GUI

From a command line install mutt.  I couldn't get sendmail to send an email that vtiger would intercept.  so i'm going to use MUTT as part of the shell scripts later on to do the itneraction

yum install mutt

create a file in /tmp/mail.txt

Subject: This is an EMAIL From: ticket@issabel.company.com
save those changes and try and send a test email

mutt -s "test" ticket@issabel.company.com < /tmp/mail.txt

If you logon to the ticket account, you should see this email.

Now lets configure vTIGER to get these emails.

Log into Vtiger and click on the menu button in the upper left corner (its got 3 horiztonal bars stacked) and select SETTINGS CRM SETTINGS

Select
CONFIGURATION - Outgoing Server
Select the "EDIT" button on the right

Server Type = Other (assuming you are going to use the ISSABEL email server, aka postfix)
Server Name = issabel.company.com
Username = ticket@issabel.company.com
Password = whatever password you set.
From email = ticket@issabel.company.com
Requires Authentication - leave unchecked

click on SUBMIT


If everything configured, then the "ADMIN" email account should have a test email from vTIGER with a subject " Test mail about the mail server configuration"

If there are some problems, a log you can look at is /var/log/maillog
That contains all email transaction history with the system.

NOTE:  If you are installing vtiger on an different server than your mail relay, make sure that in Issabel- EMAIL - Relay that the network your vTiger is running on is in that list of authorized networks.

Now we setup a system that, upon "TICKET" receiving an email, it will generate a ticket.

click on
OTHER SETTINGS - MAIL CONVERTER

Click on "CREATE MAILBOX NOW"

Scanner Name = "mail2ticket"
Server = issabel.company.com
Username = ticket@issable.company.com
password = whatever password you set
protocol = imap4
SSL type = SSL
SSL Method = do not validate
Everything else can be left default.

click NEXT

Assuming you have everything entered properly, it will move on to Section 2
Sometimes a stall is encountered here.  It will remember the mail settings above, but i dont get a response at this point.  Sometimes i have to repeat the above step.  (data will still be there, have to hit next to try again)

Select INBOX

Select NEXT

(if the system doesn't autmatically take you to "ADD RULE" popup box, then just click on the +ADD RULE box in the upper right corner)

Set "TO" = ticket@issabel.company.com
set "MATCH = any condition

Click FINISH

Now leave this screen up, you 'll see the upper right corner "ACTIONS" were going to need that in a min.

Go to issabels' webmail and logon as ADMIN

Send an email to "ticket@issabel.company.com"

Go BACK to vtiger screen and click on the drop box "ACTIONS" and select "SCAN NOW"
(if scan now isn't in the availabe drop box, click on OTHER SETTINGS -MAIL CONVERTOR to refresh)

Now click on the 3 hortizontal bars on the top left
Select SUPPORT - TICKETS

You should see at least 1 (maybe a couple) of tickets depending on test emails.
But essentially, for every email, the system should have generated a ticket!

Now lets get the system running this automatically

crontab -e

press "o" (oh) to get a new line at the bottom

enter this in
*/15 * * * * /bin/sh /var/www/html/vtigercrm/cron/vtigercron.sh

then press ESC
then press :wq!

chmod +x /var/www/html/vtigercrm/cron/vtigercron.sh
service crond restart

Now in vTIGER go to AUTOMATION - SCHEDULER
You might need to click in and out of this window, but within a minute or so, the "last scan" columns should populate.

Now there is a 'feature' with vTIGER, these jobs only update minimum every 15 minutes.
vTiger is pretty good, but developers missed the mark here.  15 minute between updates of something is really an eternity in many worlds!  So lets DECREASE it to every 1 minute.  Even that is too long.  I am generating a ticket from email, i want that ticket number now.  not 60 seconds from now.  What if they are on the phone waiting?

Anyway, open up this file;
/var/www/html/vtigercrm/config.inc.php

and down towards the bottom you will see items like
// Maximum time limit for PHP script execution (in seconds) 
$php_max_execution_time = 0;
// Set the default timezone as per your preference
$default_timezone = 'UTC';

Add in:

$MINIMUM_CRON_FREQUENCY = 1;

And then save your changes.

Back in vTIGER - AUTOMATION - SCHEDULER
click on the 'pencil' to edit a job.  and now you can change it from 15 minutes minimum, to 1 minute minimum

Now edit your crontab
crontab -e

and you should see an entry LIKE
* 15 * * * /bin/sh /var/www/html/vtigercrm/cron/vtigercron.sh

Change the 15 portion to :

* * * * * /bin/sh /var/www/html/vtigercrm/cron/vtigercron.sh

Save your changes

restart crontab in Centos 7
service crond restart

Back in vTIGER - AUTOMATION - SCHEDULER

click on the 'pencil' to edit a job.  and now you can change it from 15 minutes minimum, to 1 minute minimum.


TEST!


***** FAILED EMAIL HELP *******
Check /var/log/mailllog it was showing a problem

" warning: do not list domain issabel.company.com in BOTH mydestination and virtual_mailbox_domains "

closer inspection of /etc/postfix/main.cf  showed the following at the VERY end of the file (generated by ISSABEL configuration scripts) being misconfigured.

virtual_transport = lmtp:unix:/var/lib/imap/socket/lmtp
inet_protocols = ipv4
myhostname = issabel.company.com
mydomain = company.com
virtual_mailbox_domains = issabel.company.com

Change the last 3 sections

virtual_transport = lmtp:unix:/var/lib/imap/socket/lmtp
inet_protocols = ipv4
myhostname = issabel
mydomain = company.com
virtual_mailbox_domains = issabel.company.com

saved changes

service postfix restart



No comments:

Post a Comment