Difference between revisions of "Email Piping"

From WHMCS Documentation

(Spam Control)
Line 54: Line 54:
  
 
Email piping can include the problem of Spam sent via email. To help with this, WHMCS includes spam control filters.  See the [[Spam Control]] article for more information.
 
Email piping can include the problem of Spam sent via email. To help with this, WHMCS includes spam control filters.  See the [[Spam Control]] article for more information.
 +
 +
Emails received to the support email address which are not imported into the ticket system due to matching a Spam Control Rule, will be logged in the ''Utilities > Logs > Ticket Mail Import Log'' with the status '''Blocked Sender'''
  
 
==Common Problems==
 
==Common Problems==

Revision as of 09:20, 17 July 2020

Email piping automatically imports emails for an email address into the support ticket system. As a result, clients can open and reply to tickets via email without the need to log in to the client area first.

Begin by first configuring your support ticket departments. You do this by going to Setup > Support > Support Departments. Add each of your departments and the email address that you assigned to them.

Note:
If you have customized the location of the crons directory, adjust the file path examples below accordingly.

Forwarder Method

Watch Video Tutorial
This method is recommended if you use cPanel or DirectAdmin and are piping in emails from the same domain that you installed WHMCS on.
The x3 forwarder configuration page

To set up email piping via forwarders, you must configure your server to pipe messages to WHMCS. To configure this, navigate to the Email Forwards section of your web hosting control panel and create a forwarder.

Sample Forwarder Command

| php -q /home/username/public_html/whmcs/crons/pipe.php

You can find a copy-and-paste-ready command with the specific path for your setup. Navigate to Setup > Support Departments within your WHMCS installation and copy the command from the forwarder command field.

Important Notes
Note: The pipe.php file requires 755 permissions to function properly.
If using DirectAdmin, you must enter the command enclosed in quotes ("") for the system to accept it.

POP3 Import Method

The cron command

We recommend this method if you use any control panel other than cPanel or if you are wanting to pipe emails from multiple domains. If you wish to pipe emails in from a Gmail or Google Apps Mail account, we have specific instructions at Email Piping with Google Apps.

To use this method:

  1. On your mail server, create a unique email account for each support department. This must be a full inbox; an alias is not sufficient.
  2. In WHMCS, navigate to Setup > Support > Support Departments > Edit.
  3. Enter the pop email access details for each department.
  4. Set up a cron job to run the pop.php file, using the "Ticket Importing using POP3 Import" command on the Support Departments page, every few minutes. We recommend that you set this to run every five minutes.

Your PHP build needs IMAP support for this method to function correctly.

Important Note
When using the POP import method, the system will delete emails in the source mailboxes upon successful import into WHMCS.

Testing the Email Piping

After you set up the piping, try sending a test email to it. If the piping is correctly configured, the system will open a new ticket (it can take up to 5 minutes if using the cron job method). For testing purposes, you should not use your admin email address to send the message. The system expects emails from admin email addresses to be replies to tickets only, and so it won't open new tickets.

If the system doesn't create a ticket when sending in an email, check in Utilities > Ticket Mail Import Log. If WHMCS received the message, it will appear in this list with the reason why it failed to create a ticket. If the message you sent doesn't appear here, then the forwarder you set up previously is not working correctly and WHMCS didn't receive the message.

If you get the error message "Ticket ID Not Found", you are trying to open a support ticket from your admin email address. Admins can only reply to tickets, not open new ones. Submit a ticket from any other email address and the system should accept it.

For other errors, see the following Common Problems and Troubleshooting sections.

Spam Control

Email piping can include the problem of Spam sent via email. To help with this, WHMCS includes spam control filters. See the Spam Control article for more information.

Emails received to the support email address which are not imported into the ticket system due to matching a Spam Control Rule, will be logged in the Utilities > Logs > Ticket Mail Import Log with the status Blocked Sender

Common Problems

If the system didn't pipe an email into the ticket system, first see Utilities > Logs > Ticket Mail Import Log. This shows all the emails that WHMCS's email piping feature has processed and any errors that may have occurred. Below are the three most common errors:

Ticket ID Not Found

This error message indicates that you are using an email address that you assigned to an administrator to send your email. Administrators can only reply to tickets, not open new ones. To test this, you must send an email from an email address that doesn't belong to an admin in your WHMCS system.

Blocked Potential Email Loop

This error message indicates that WHMCS received a large number of emails from the same email address, indicating an auto-responder loop. To break the cycle, WHMCS did not import the email. By default, the system will block any new tickets from the offending address if it receives 10 emails from the same address within a 15 minute period. You can customize this in the General Settings.

Unregistered Email Address

This error message indicates that you have chosen to only allow registered clients to open tickets in this department. You must uncheck the Clients Only checkbox in Setup > Support Departments > Edit to allow the public to create tickets.

Only Replies Allowed by Email

This error message indicates that an the department email address received an email, but the subject did not contain a ticket ID. As a result, the email represents a new ticket rather than a reply to an existing one. Because you enabled the Pipe Replies Only option in the support department configuration, the system rejected the email.

Troubleshooting

If the system hasn't piped an email into the ticket system and it is not in the Ticket Mail Import Log (above), follow the steps below to identify the cause of the problem. There are different procedures depending upon whether you use the email forwarder or cron piping methods.

Unable to communicate with the WHMCS installation

This error occurs when the cron.php file is unable to communicate with the WHMCS installation. It typically occurs when you have customized the location of the /crons directory. The cron.php file will look for the WHMCS directory in the location in the /crons/config.php file. To resolve this error:

  1. Open the /crons/config.php file
  2. Uncomment the $whmcspath line by removing the preceding // characters.
  3. Ensure the $whmcspath path is the full system path to your WHMCS directory. This is the directory that contains the init.php and clientarea.php files.

An example of a correctly-completed file is available on this page.

Email Forwarder Method

Local Delivery Failed Error Message

If a bounce email includes an error that states local delivery failed (like the error shown below) when sending an email in to your piped email address, the forwarder entry is not correct. The message will not go to the pipe.php script.

pipe to |/home/username/public_html/whmcs/crons/pipe.php
generated by support@yourdomain.com
local delivery failed

To correct this, ensure the /crons/pipe.php file uses 755 permissions. Then, try the following variations of the email forwarder command:

|/usr/bin/php -q /home/username/public_html/whmcs/crons/pipe.php
|/usr/local/bin/php -q /home/username/public_html/whmcs/crons/pipe.php

Why is email piping with Direct Admin sending the email twice?

To fix this problem you need to remove or comment out "unseen" from your exim.conf file.

For example:

virtual_aliases_nostar:
 driver = redirect
 allow_defer
 allow_fail
 data = ${if exists{/etc/virtual/${domain}/aliases}{${lookup{$local_part}lsearch{/etc/virtual/${domain}/aliases}}}}
 file_transport = address_file
 group = mail
 pipe_transport = virtual_address_pipe
 retry_use_local_part
 #unseen
 #include_domain = true

Reference: Directadmin forum thread

Cron Piping Method

When using the Cron Piping method, it is possible to see the error that has prevented importing emails. First, temporarily add the following variable to the configuration.php file:

$pop_cron_debug = true;

Next, visit the pop.php file directly in your browser (for example, http://www.yourdomain.com/crons/pop.php). You may encounter the common errors below:

Could Not Authenticate

This error indicates that the POP details in the required fields are incorrect. It could also be an intermittent issue between your WHMCS server and the mail server.

To troubleshoot this:

  • Go to Setup > Support > Support Departments.
  • Edit the department that the notification email referenced.
  • Verify that the POP3 settings use correct values (username (user@email.tld), password, and port),
  • Verify that the hostname is a FQDN and resolves. Alternately, check with your system administrator or hosting provider for the correct connection details to use for POP3.
  • Click Save Changes.

Sender Verify Failed

This error indicates that the SMTP server requires a valid account on the server to send from.

Check that the "From Address" under Setup > General Settings > Mail Tab is not blank and you have entered a valid address that is authorized to send mail through the SMTP server. You may need to check with your hosting provider or mail server administrator.

Too Many Login Failures

This error indicates that the mail server is blocking WHMCS because the login details under Setup > Support > Support Departments > Edit (email piping) are incorrect.

Check whether the details you entered are correct. After correcting them, you will need to wait out the block time. If you use a cPanel server, you can whitelist the WHMCS IP address in cPHulkd or remove the WHMCS IP address from the blacklist. For more information, see documentation.

WHMCS Pop Cron Did Not Run

This error indicates a problem with the POP3 Import Method feature, which imports emails into the WHMCS Support ticket system. It indicates that you have entered POP3 details for a support department, but you haven't configured the required cron job or finished importing the emails.

Step-by-step instructions to resolve this warning email are in this help guide.

After you have applied one of these resolutions, the system will stop sending the warning email.