cPanel/WHM Issues with MailWizz - How To Fix

Status
Not open for further replies.

sendmedialtd

Active Member
Hey,

I've had a few issues with getting MailWizz working properly on a server that has cPanel/WHM installed. Below are some issues which iv had to trouble shoot myself and fix them myself, so i thought I'd create a topic so anyone else who may have the same issues can look at this thread and fix them themselves. This topic will be updated as new issues arise with a guide on how to fix the problem. If your issue is not listed then feel free to add to this and i will see if i can fix it for you.

If you have had any other issues yourself and have fixed them please let me know in the comments so i can add them to this thread. If any of the below issues have resolved your problems make sure you give this Thread a LIKE or comment to say thank you.

1) Connection Refused

Some of you who have the Connection Refused error when adding SMTP/Feedback Loop/Bounce Server settings is caused by one of 2 issues. The first one being the SMTP Restriction, make sure that you go to WHM > Security Centre > SMTP Restirctions and TURN OFF that feature.

If you have Config Server Firewall Enabled then you will also need the do the following 2 changes, go to WHM > Pluggins > Config Server Firewall & Security. Click on the Config Server Firewall Tab and then click on Firewall Configuration. If SMTP_BLOCK is enabled then leave it as Enabled and then search for SMTP_ALLOWUSER. You will need to add the account username to the SMTP_ALLOWUSER section that is hosting the MailWizz App. Without doing so the firewall will keep blocking outgoing SMTP connections. Do NOT turn off SMTP_BLOCK as its there for your security. If you turn it off then it will allow ALL accounts on your server to connect to outgoing SMTP services which can be a security risk for any exploited scripts running on the server. Please make sure you read the next issue too.

Another thing to check is to make sure in the Firewall Configuration that you have Port 25 showing in the TCP_OUT setting otherwise your server will not be able to connect to any outgoing SMTP server using port 25. Also make sure Ports 465 for SSL and 587 for TLS is also OPEN on the firewall.

2) Connection Timed Out

Following on from the above issue there is another issue which when validating SMTP Servers where you may get the following warning:

++ Swift_SmtpTransport started
>> MAIL FROM:<jenny@DOMAIN.co.uk>
<< 250 OK
>> RCPT TO:<mike@DOMAIN.co.uk>
<< 250 Accepted
>> DATA
<< 354 Enter message, ending with "." on a line by itself
!! Connection to mail.DOMAIN.co.uk:25 Timed Out (code: 0)

Please ignore that warning, your validation email has actually been delivered so make sure you check your emails and click on the link to validate the SMTP Server. As you can see from the warning you "<< 250 Accepted" the emails was accepted and delivered fine. As for the Time Out error it looks to be a false warning. I've looked into the Exim Logs and can see the following:

2017-08-29 01:19:53 SMTP connection from [67.225.XXX.XX]:51872 (TCP/IP connection count = 1)
2017-08-29 01:20:21 SMTP connection from [127.0.0.1]:34654 (TCP/IP connection count = 2)
2017-08-29 01:20:21 SMTP connection from (localhost) [127.0.0.1]:34654 closed by QUIT
2017-08-29 01:20:44 1dmUGM-000200-1X spam acl condition: spamd: failed to connect to any address for 127.0.0.1: Connection refused
2017-08-29 01:20:44 1dmUGM-000200-1X spam acl condition: all spamd servers failed
2017-08-29 01:20:44 1dmUGM-000200-1X H=server.DOMAIN.co.uk (DOMAIN.co.uk) [67.225.XXX.XX]:51872 Warning: "SpamAssassin as cpaneleximscanner detected OUTGOING smtp message as NOT spam ()"
2017-08-29 01:20:44 1dmUGM-000200-1X <= jenny@DOMAIN.co.uk H=server.DOMAIN.co.uk (DOMAIN.co.uk) [67.225.XXX.XX]:51872 P=esmtpa A=dovecot_login:jenny@DOMAIN.co.uk S=4837 id=b88b4d75b029b6193a74da0931b591b6@DOMAIN.co.uk T="Please validate this server." for mike@DOMAIN.co.uk
2017-08-29 01:20:44 SMTP connection from server.DOMAIN.co.uk (DOMAIN.co.uk) [67.225.XXX.XX]:51872 closed by QUIT

From what i can tell from the Exim Logs is that its actually the MTA that MailWizz uses that is closing the connection using the QUIT command, but for what ever reason MailWizz is reporting it as an error. I've informed @twisted1919 about this and we will all just have to wait and see if anything can be done about this or if i can find a way myself on how to resolve the false warning.

EDIT: Even though the emails still get sent, if you actually want to do it so you dont get the timeout error then make sure you increase the Timeout on the Deliver Server setting. Increase this to 60 should resolve the problem.

3) exec function must be enabled in order to handle the DKIM keys.

With the latest Cpanel/WHM you will have multiple PHP versions installed which allow you to control which accounts use what version of PHP. Your first thought is to check the Disabled Functions in the PHP INI file. How ever you will see that the disabled_functions section is blank which may seem confusing. This is because cPanel/WHM by default will automatically disable some functions without you even knowing, exec being one of them. To stop this you first need to find out what version of PHP the account hosting MailWizz is using, go to the following, WHM > Software > MultiPHP Manager. Find your account and look at what PHP Version the account is using i.e ea-PHP70.

Then using an Editor or download Config Server Explorer (highly recommended) you then need to edit the following file /opt/cpanel/ea-php70/root/etc/php-fpm.d/YOURDOMAIN.com.conf

Remember to replace ea-php70 with the php version your account is using and change YOURDOMAIN.com to your actual domain name.


By default you will see the following: php_admin_value[disable_functions] = exec,passthru,shell_exec,system

Make sure you remove exec from that list and then click Save and then Restart PHP and Apache via WHM > Restart Services.

4) No Campaigns are sending and no Cron Jobs are running.

Ok so again it seems the cron command may need to be different for cPanel/WHM servers. First of all login to SSH using Putty. You then want to type in the following command:

Code:
which php

That will give you a response such as /usr/local/bin/php. That is the path to PHP in order to run Cron Jobs. When installing MailWizz the setup guide will tell you to install cron jobs with the path to PHP as /usr/bin/php (without the local part). That is because that is the usual path to PHP and will work on most servers, how ever it seems yet again cPanel/WHM like to make things confusing. So if the response you got was somthing different to the ones you have setup in your Cron Tab then make sure you update the path to PHP. Once you have done so then your Cron Jobs will start to work and you should now see your campaigns starting to be processed.

5) Error 400! The CSRF token could not be verified.

This error is produced when your PHP is not setup correctly or changes need to be made. The most common reason for this is the setting for post_max_size and upload_max_filesize. Login to WHM and go to PHP INI Editor and then select Editor Mode. Select the PHP version of the account MailWizz is hosted on and then search for upload_max_filesize, you need to increase that value. I have mine set at 500M because its a dedicated server and i only user MailWizz on the server. You then need to search for post_max_size and increase the value of that, i have that set to 200M. Once done click Save, and then restart PHP and Apache.

6) Error 500! Missing the temporary folder to store the uploaded file "FILENAME.csv".

This error is produced because it has no path set in PHP of where to store tempory files. Login to WHM and go to PHP INI Editor and then select Editor Mode. Select the PHP version of the account MailWizz is hosted on and then search for upload_temp_dir. You want to set the path to /tmp which is the default location by most servers. Also make sure you uncomment the line out if it is by removing the ; from the beginning so it says upload_tmp_dir and NOT ;upload_tmp_dir
Save, restart PHP and Apache.

7) Connection to the Delivery Servers taking longer than 20 seconds?

There are a few different reasons for why this could be happening, the main reason for this is because of a Delay setting in WHM, to change this you need to go to "Home »Service Configuration »Exim Configuration Manager". Under ACL Options you will find this part:

"Introduce a delay into the SMTP transaction for unknown hosts and messages detected as spam. "

If that is turned on then make sure you turn it OFF. Save the Exim Configuration and restart Exim.

If that still hasnt fixed the issue for you then your issue will be because of the version of cPanel/WHM you are running, make sure you have upgraded from EasyApache3 to EasyApache4 as if you've not then you wont be able to download the new versions of cPanel/WHM. To do this login to SSH as ROOT and run this command:

Code:
/scripts/migrate_ea3_to_ea4 --run

The upgrade will take a while so wait for it to complete. Once you've upgraded then make sure you upgrade the cPanel/WHM software to the latest version. I've seen people with old versions (including myself) of Exim/cPanel/WHM cause this delay and once upgraded theres no such issue. Again upgrading cPanel/WHM (which will internally upgrade Exim) will take an hour or so to complete.

Note: This setting is for the Servers the Delivery Servers are on. So for example if you have 1 server hosting MailWizz and another server you use for your Delivery Servers then its just the Delivery Servers server you need to make this change to.

---------------------------------------------------

Thanks,
Mike
 
Last edited:
I think both would be good, as you and i both know that if people need help they dont bother reading the KB and instead ask the questions/search on the forum instead. For those that bother to research/search the KB first then a big thumbs up to you lot, for those that dont then they can have this to read.
 
Another thing to check is to make sure in the Firewall Configuration that you have Port 25 showing in the TCP_OUT setting otherwise your server will not be able to connect to any outgoing SMTP server using port 25.
You might want to add 465 for SSL and 587 for TLS to it ;)

2) Connection Timed Out

Following on from the above issue there is another issue which when validating SMTP Servers where you may get the following warning:

Please ignore that warning, your validation email has actually been delivered so make sure you check your emails and click on the link to validate the SMTP Server. As you can see from the warning you "<< 250 Accepted" the emails was accepted and delivered fine. As for the Time Out error it looks to be a false warning. I've looked into the Exim Logs and can see the following:

From what i can tell from the Exim Logs is that its actually the MTA that MailWizz uses that is closing the connection using the QUIT command, but for what ever reason MailWizz is reporting it as an error. I've informed @twisted1919 about this and we will all just have to wait and see if anything can be done about this or if i can find a way myself on how to resolve the false warning.
Just tried to reproduce this error (w/ phpMailer and SwiftMailer), but could not, perhaps it is specific to your server install/setup?

Then using an Editor or download Config Server Explorer (highly recommended) you then need to edit the following file /opt/cpanel/ea-php70/root/etc/php-fpm.d/YOURDOMAIN.com.conf
Editing this file is not recommended, it might yield problems later, especially if you forget you did it there and try to do the edits the normal way, as shown here: https://forum.mailwizz.com/posts/26512
 
You might want to add 465 for SSL and 587 for TLS to it ;)


Just tried to reproduce this error (w/ phpMailer and SwiftMailer), but could not, perhaps it is specific to your server install/setup?


Editing this file is not recommended, it might yield problems later, especially if you forget you did it there and try to do the edits the normal way, as shown here: https://forum.mailwizz.com/posts/26512

1) Will add to the list now, good call.

2) Maybe but i cant find anything that is making this happen. I'll keep searching the logs and changing settings to see what i can do.

3) Thats not possible, like i say nothing shows in the PHP INI files under Disabled Functions, so the only way to resolve it is editing the file mentioned in my original post. cPanel/WHM will disable some functions by default even if they are not in the PHP INI file, so you have to edit the cPanel Admin PHP INI file in order to remove exec from the Disabled Functions list.
 
For example:

Using the method you said and i already tried:
phpini-1.png

As you can see from my method cPanel by Default disables Functions even though theres nothing showing as disabled in the INI file.
phpini-2.png
 
3) Thats not possible, like i say nothing shows in the PHP INI files under Disabled Functions, so the only way to resolve it is editing the file mentioned in my original post. cPanel/WHM will disable some functions by default even if they are not in the PHP INI file, so you have to edit the cPanel Admin PHP INI file in order to remove exec from the Disabled Functions list.
As you can see from my method cPanel by Default disables Functions even though theres nothing showing as disabled in the INI file.
Hmm, I see, my hunch is, perhaps the default php version is a different one (or some similar issue, like chosen php version for directory, domain, or cpanel), which could be tested by calling 'php -v' depending on location, and see what is set in whm, and php selector/config (or similar). But in any case, it is great that there are various ways to fix this problem!whm=MultiPhpMgr.jpg phpSelector=phpConfig.jpg
 
Updated the Connection Timed Out false report. Not sure how none of us thought of this before or how i even missed that setting!
 
Updated the Connection Timed Out false report. Not sure how none of us thought of this before or how i even missed that setting!
Probably b/c it does not happen oft that 30s is not enough for the timeout, as most own or pro 3rd party DS are fast ;)
 
Status
Not open for further replies.
Back
Top