Difference between revisions of "Email Piping: Google Apps"

From WHMCS Documentation

(Workaround for those without SSL)
 
(20 intermediate revisions by 7 users not shown)
Line 1: Line 1:
This article covers how to go about configuring your WHMCS installation's Support Ticketing feature along with Google Apps Hosted Email Service for Domains.
+
This article covers how to go about configuring the support ticket system to enable importing of new tickets and replies from e-mail accounts hosted with GSuite (formerly known as Google Apps).
  
It is assumed that you already have your WHMCS installation set up and working properly on your web server.
+
Before beginning, we recommend having WHMCS set up and working properly on your web server so as to avoid any unexpected issues.
If so then you are ready to go!
 
  
Follow these steps:
+
==Configuration==
  1. Create a google app acct for your domain
 
  2. Verify your domain for Google
 
  3. Log into Google Control Panel for your domain and create
 
      appropriate email accounts  that will be using WHMCS ticketing
 
      system and receiving tickets.
 
  4. For all accounts that will be receiving tickets, be sure to enable
 
      POP3 and IMAP in  Google Mail's webmail interface.
 
  5. Adjust your mx records on your webserver to redirect your email
 
      service to google.
 
  6. Here's one of the "gotchas" in getting this set up.  You must enable
 
      Imap-SSL/Pop3-SSL with your webserver's php installation.  Many
 
      times you will need to contact your hosting providers to do this for
 
      you.  The reason for that is because  Google Mail services will only
 
      accept secured connections.
 
  7. In WHMCS, in support depts, Create a department and configure
 
      the email account  assigned to it like so:
 
      '''hostname: pop.gmail.com
 
      port: 995
 
      user: youremail@yourdomain.com
 
      pwd: yourpassw0rd'''
 
  8. In the account you set up in WHMCS in support dept, make sure to
 
      go into  google settings  to enable both IMAP and POP.
 
  9. Set up your cron job within your Web Hosting control panel
 
      (Plesk, cPanel, Direct Admin etc.):
 
      */5 * * * * php -q /home/username/public_html/whmcs/pipe/pop.php
 
  
If you complete these steps then this should work wonderfully.
+
Follow these steps: <br>
 +
1. Create a GSuite account at https://gsuite.google.com/ <br>
 +
2. Verify the domain where WHMCS is installed with GSuite and complete their setup process. <br>
 +
3. Log in to the Admin Console at https://gsuite.google.com/ and create appropriate email accounts that will be using the WHMCS ticketing system and receiving tickets and replies.<br>
 +
<div class="docs-alert-success">A separate email account should be created for each support department.</div>
  
There are a few troubleshooting steps one can take in troubleshooting this, if your set up isn't working properly.
+
<div class="docs-alert-info">
 +
Starting with version 8.1 WHMCS can use OAuth to authenticate with your GSuite account. For details on how to do this please check our [https://help.whmcs.com/m/support_tools/l/1328652-setting-up-pop3-importing-with-oauth-via-google Setting Up POP3 Importing with OAuth via Google] guide.
 +
</div>
  
# Check your ticket import logs in your WHMCS installation:  Utilities > Ticket Mail Import Log
+
4. For all accounts that will be receiving tickets, be sure to enable POP3 and IMAP in GMail's webmail interface:  [https://support.google.com/a/answer/9003945 Enable IMAP] [https://support.google.com/mail/answer/7104828 Enable POP3]
What you are looking for here is to see if your Cron Job is attempting any import at all.  If you don't see anything here then your cron job is '''not successfully attempting''' a ticket import.
 
# Verify that, for your google email account you created, you have enabled both Pop3 and IMAP.
 
# Verify that you cron job has been created and is running.
 
# If the cron job is running, view the emails that your cron job is creating (you can configure your cron job to email its results to an email address) and see if an error is being generated.
 
'''An Error Occurred: Can't connect to gmail-pop.l.google.com,995: Connection refused'''
 
and
 
'''Host: pop.gmail.com Email: info@yourdomain.com An Error Occurred: Too many login failures'''
 
# Check that your server's firewall isn't blocking traffic to google.
 
# To make absolutely sure that your server's firewalls are not blocking your connection attempts, run this telnet command from your server:    '''telnet gmail-pop.l.google.com 995'''
 
This can be another 'gotcha' as well.  Often times this is overlooked by users and, also, server admins.
 
If that command succeeds and no other firewall restrictions are in place, then your connection is unobstructed on your server side.
 
# If you are still having issues after verifying the suggested troubleshooting steps above, then you will need to contact google or visit their discussion forums for Google Apps.  It is possible they may be blocking your server from accessing their mail servers.
 
  
Final thoughts:
+
<div class="docs-alert-info">Enable '''Enable POP for mail that arrives from now on'''. Otherwise, POP will be enabled for all emails in the inbox (even older emails that may not need to be imported) and will cause all of them to be imported by WHMCS.</div>
WHMCS and Google Apps do play well together and it does work, regardless of what version of Google Apps you are using: Standard, Premier or Education.  If you get them working together, you'll be a happy camper.  Just be diligent in your troubleshooting.
 
  
Workaround for those without SSL:
+
5. Please ensure that Imap-SSL/Pop3-SSL is in the PHP installation on the server. Such a change (if needed) will usually require the hosting provider or system administrator to do this. The reason for enabling this is because GSuite services will only accept secured connections.
Create another POP3 e-mail account at a different domain name outside Google Apps (that does not require SSL to pick up via POP3), and then have your Google Apps e-mail forward to that e-mail address. Then in WHMCS use POP3 to pickup your mail at the POP3 account that does not require SSL.  The user will never notice since they send all e-mailed to your Google Apps address, and receive e-mails "from" your Google Apps address (or whatever address you have assigned in WHMCS for that support department).
+
6. Under  '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Support Departments]]''' or, prior to WHMCS 8.0, '''Setup > Support > Support Departments'''.  in WHMCS, create at least one department and configure the email account assigned to it like so:
 +
'''hostname:''' pop.gmail.com
 +
'''port:''' 995
 +
'''user:''' youremail@yourdomain.com
 +
'''pwd:''' yourpassw0rd
 +
 
 +
7. Create a cron job to trigger the <tt>/crons/pop.php</tt> file every 5 minutes. For help, see [[Cron Configuration]].
 +
 
 +
Once this is done, any new emails to the support email addresses should be imported. If they are not, please follow the troubleshooting steps below to determine the cause and correct it as needed.
 +
 
 +
==Troubleshooting==
 +
If e-mails are not being imported from GSuite as expected, there are some steps that can be taken to debug and correct this.
 +
 
 +
The first step is to check the ticket import logs in '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' or, prior to WHMCS 8.0, '''Utilities > Logs''' in the WHMCS admin area. Look for any entries for the e-mails in question. If there are no applicable entries present, it usually indicates that the pop.php cron job isn't set up  or is unable to successfully import the e-mails due to one or more of the below reasons:
 +
 
 +
* Verify that Pop3 and IMAP is enabled for the applicable Gsuite inbox as described in the Configuration section above and that the /crons/pop.php cron job has been created and is running every 5 minutes.
 +
* If the cron job is running, view the output that it is creating (depending on the server, the cron job to email its results to an email address) and see if an error is being generated.
 +
* If that command succeeds and no other firewall restrictions are in place, then the connection is unobstructed on your server side.
 +
 
 +
For more specific troubleshooting of the above, please refer to our help articles at [https://help.whmcs.com/m/support_tools/l/679784-troubleshooting-email-piping-problems Troubleshooting Email Piping Problems] and [https://help.whmcs.com/m/support_tools/l/679785-troubleshooting-email-piping-problems-advanced Troubleshooting Email Piping Problems Advanced]
 +
 
 +
===Connection refused===
 +
* Check that the server's firewall isn't blocking traffic to google.
 +
* To make absolutely sure that the server's firewall is not blocking your connection attempts, run this telnet command from the server using SSH:    '''telnet gmail-pop.l.google.com 995'''
 +
 
 +
===Too many login failures===
 +
* Double-check the username and password entered on the Support Department configuration are correct. You can find these at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Support Departments]]''' or, prior to WHMCS 8.0, '''Setup > Support > Support Departments'''.
 +
* Adjust the Gmail account settings to allow [https://support.google.com/accounts/answer/6010255?hl=en-GB less secure apps]. This allows external applications such as WHMCS to authenticate to the account via username and password.
 +
* Check the Recent Activity page in Gmail to see whether the login attempt was blocked at their end: [https://support.google.com/accounts/answer/6063333?hl=en ‘Suspicious sign in prevented’ email].
 +
 
 +
===Can not authenticate to POP3 server===
 +
Refer to the troubleshooting steps for [[#Too many login failures]]
 +
 
 +
===Password command failed===
 +
Refer to the troubleshooting steps for [[#Too many login failures]]
 +
 
 +
If there are any issues after verifying the suggested troubleshooting steps above, it will be necessary to contact Google or visit their discussion forums for GSuite.  It is possible they may be blocking your server from accessing their mail servers.
 +
 
 +
===Email imported multiple times===
 +
This situation occurrs if a single mailbox is shared between multiple WHMCS support departments. To resolve this please configure a separate email account for each department.
 +
 
 +
==Workaround for those without SSL==
 +
 
 +
In some cases, it may be necessary to work around your server not properly handling SSL for POP3. To do so, create another POP3 e-mail account at a different domain name outside GSuite (that does not require SSL to pick up via POP3), and then have your GSuite e-mail forward to that e-mail address. Then in WHMCS, use POP3 to pick up the e-mail at the POP3 account that does not require SSL.  The user will never notice since they send all e-mails to your GSuite address, and receive e-mails "from" your Google Apps address (or whatever address you have assigned in WHMCS for that support department).

Latest revision as of 20:25, 21 April 2022

This article covers how to go about configuring the support ticket system to enable importing of new tickets and replies from e-mail accounts hosted with GSuite (formerly known as Google Apps).

Before beginning, we recommend having WHMCS set up and working properly on your web server so as to avoid any unexpected issues.

Configuration

Follow these steps:
1. Create a GSuite account at https://gsuite.google.com/
2. Verify the domain where WHMCS is installed with GSuite and complete their setup process.
3. Log in to the Admin Console at https://gsuite.google.com/ and create appropriate email accounts that will be using the WHMCS ticketing system and receiving tickets and replies.

A separate email account should be created for each support department.

Starting with version 8.1 WHMCS can use OAuth to authenticate with your GSuite account. For details on how to do this please check our Setting Up POP3 Importing with OAuth via Google guide.

4. For all accounts that will be receiving tickets, be sure to enable POP3 and IMAP in GMail's webmail interface: Enable IMAP Enable POP3

Enable Enable POP for mail that arrives from now on. Otherwise, POP will be enabled for all emails in the inbox (even older emails that may not need to be imported) and will cause all of them to be imported by WHMCS.

5. Please ensure that Imap-SSL/Pop3-SSL is in the PHP installation on the server. Such a change (if needed) will usually require the hosting provider or system administrator to do this. The reason for enabling this is because GSuite services will only accept secured connections. 6. Under Configuration () > System Settings > Support Departments or, prior to WHMCS 8.0, Setup > Support > Support Departments. in WHMCS, create at least one department and configure the email account assigned to it like so:

hostname: pop.gmail.com
port: 995
user: youremail@yourdomain.com
pwd: yourpassw0rd

7. Create a cron job to trigger the /crons/pop.php file every 5 minutes. For help, see Cron Configuration.

Once this is done, any new emails to the support email addresses should be imported. If they are not, please follow the troubleshooting steps below to determine the cause and correct it as needed.

Troubleshooting

If e-mails are not being imported from GSuite as expected, there are some steps that can be taken to debug and correct this.

The first step is to check the ticket import logs in Configuration () > System Logs or, prior to WHMCS 8.0, Utilities > Logs in the WHMCS admin area. Look for any entries for the e-mails in question. If there are no applicable entries present, it usually indicates that the pop.php cron job isn't set up or is unable to successfully import the e-mails due to one or more of the below reasons:

  • Verify that Pop3 and IMAP is enabled for the applicable Gsuite inbox as described in the Configuration section above and that the /crons/pop.php cron job has been created and is running every 5 minutes.
  • If the cron job is running, view the output that it is creating (depending on the server, the cron job to email its results to an email address) and see if an error is being generated.
  • If that command succeeds and no other firewall restrictions are in place, then the connection is unobstructed on your server side.

For more specific troubleshooting of the above, please refer to our help articles at Troubleshooting Email Piping Problems and Troubleshooting Email Piping Problems Advanced

Connection refused

  • Check that the server's firewall isn't blocking traffic to google.
  • To make absolutely sure that the server's firewall is not blocking your connection attempts, run this telnet command from the server using SSH: telnet gmail-pop.l.google.com 995

Too many login failures

  • Double-check the username and password entered on the Support Department configuration are correct. You can find these at Configuration () > System Settings > Support Departments or, prior to WHMCS 8.0, Setup > Support > Support Departments.
  • Adjust the Gmail account settings to allow less secure apps. This allows external applications such as WHMCS to authenticate to the account via username and password.
  • Check the Recent Activity page in Gmail to see whether the login attempt was blocked at their end: ‘Suspicious sign in prevented’ email.

Can not authenticate to POP3 server

Refer to the troubleshooting steps for #Too many login failures

Password command failed

Refer to the troubleshooting steps for #Too many login failures

If there are any issues after verifying the suggested troubleshooting steps above, it will be necessary to contact Google or visit their discussion forums for GSuite. It is possible they may be blocking your server from accessing their mail servers.

Email imported multiple times

This situation occurrs if a single mailbox is shared between multiple WHMCS support departments. To resolve this please configure a separate email account for each department.

Workaround for those without SSL

In some cases, it may be necessary to work around your server not properly handling SSL for POP3. To do so, create another POP3 e-mail account at a different domain name outside GSuite (that does not require SSL to pick up via POP3), and then have your GSuite e-mail forward to that e-mail address. Then in WHMCS, use POP3 to pick up the e-mail at the POP3 account that does not require SSL. The user will never notice since they send all e-mails to your GSuite address, and receive e-mails "from" your Google Apps address (or whatever address you have assigned in WHMCS for that support department).