Send Clientexec Invoices using Google Apps or Gmail

March 28th, 2010 By Scott Savage Categories: Business, Internet, software

As a trial I have recently migrated my email from Microsoft Exchange to Google Apps. Google Apps Standard is free (even for multiple custom domains) and therefore significantly cheaper than my current Microsoft Exchange and Windows VPS setup. The built-in Mail Fetcher tool lets you keep your Google account downloading emails regularly (about every 20 mins?) from your Exchange account, while you take your time to migrate your DNS changes over. Once you are done you can shut down your Exchange account and disable Mail Fetcher.

Of course changing mail servers will have some effects, in my case it broke the email function of my Clientexec invoicing system. Luckily I found a great post by Adrian Jon Kriel that fixed my problem (thanks!), and I have reproduced it below:

Problem:
Default clientexec smtp mailer (PHPMailer) cannot handle the required SSL/TLS SMTP via port 465 for gmail.

Solution:

You will need a valid Gmail or Google Apps account with POP3 enabled (Gmail->Settings->Forwarding and POP/IMAP ->Enable POP for all mail)

Step 1) Modify the file: PHPMailer.php in your clientexec directory: /newedge/classes/

Step 2) Replace the following code around line 534:

// Retry while there is no connection
while($index < count($hosts) && $connection == false)
{
if(strstr($hosts[$index], ":"))
list($host, $port) = explode(":", $hosts[$index]);

with

// Retry while there is no connection
while($index < count($hosts) && $connection == false)
{
// modified for GMAIL
// if(strstr($hosts[$index], ":"))
// list($host, $port) = explode(":", $hosts[$index]);
if(strstr($hosts[$index],"://")) list($protocol,$hostPort) = explode("://",$hosts[$index]) ;
if(strstr($hostPort, ":")) list($host, $port) = explode(":", $hostPort);

Step 3) Change your clientexec Email settings (admin->SYSTEM SETUP-> e-mail settings)

Mail Type: SMTP
SMTP Host: ssl://smtp.gmail.com
SMTP Username: username@gmail.com (this will be your gmail login name)
SMTP Password: gmail_password (this will be your gmail login password)
SMTP Port: 465
Send Multi-Part MIME Messages: Yes or No (your own preference)

OPTIONAL

  • If you get “Connection Timeout” errors when u send an email, contact your host to open the TCP port 465.
  • On Windows servers you may need to add the “extension=php_openssl.dll” line to your php.ini configuration file.
Tags: , , , , ,
No comments yet.

Leave a Comment