After 7.4 upgrade = Error:SMTP connect failed

If you are on CentOS 6 like me, configure selinux to allow sending of email

setsebool -P httpd_can_sendmail on

This is not my case. I’ve SuiteCRM installed on Ubuntu 14.04LTS, but thanks for your suggestion.
Unfortunately, this is one of the cases where the open source fails…problem and no support.

I stumbled upon this topic while trying to debug a new installation (v7.5.1) on a new server running WHM (v54.0).

I kept getting the same error like the one mentioned above.

To debug i did the following:
Enabled debugging on class.phpmailer.php (/include/phpmailer/class.phpmailer.php) by changing

public $SMTPDebug = 0;

to

public $SMTPDebug = 3;

and

public $Debugoutput = 'echo';

to

public $Debugoutput = 'error_log';

I then tried to send a test email and opened the error_log file located at the root of the project.

In that file, i realised that even though Suite was trying to connect to the server i had set (mandrill in this case), the connection opened was on my local server.

[10-Feb-2016 17:18:15 UTC] Connection: opening to smtp.mandrillapp.com:587, timeout=300, options=array (
)
[10-Feb-2016 17:18:15 UTC] Connection: opened
[10-Feb-2016 17:18:15 UTC] SERVER -> CLIENT: 220-***.myserver.com ESMTP Exim 4.86 #2 Wed, 10 Feb 2016 17:18:15 +0000 

After some digging, it appears that by default, WHM prevents users sending from remote servers in SMTP Restrictions and redirects to the local SMTP instead.

To fix this, i went to WHM -> Security Center -> SMTP Restrictions and turned them off. Maybe not the safest thing to do, as spammers who might gain access to the server will be allowed to send emails from my server using any remote SMTP. I thought this would be unlikely and changing this option solved my issue.

Hope this helps someone.

1 Like

RobB thanks a lot. Problem solved/

Hi!
Thanks, this Problem solved.

just add, for smtpout.sercureserver.net if goddady I use the port 80.

About two days I am trying to understand what the problem with a Send Mail.

After uncheck "Allow users to use this account for outgoing email: ", email work!

Maybe this issue solver you’r problem.

Hi guys, Im using 1and1 hosting here in Spain and nothing seems to work.
You dont have real control of the server with this service, so I’m not sure even how to do some stuff you say here.
I have access to all the files, made the changes on phpmailer but it doesnt work.

The configuration from 1and1 says that 587 requires TLS for the SMTP etc, but I get always the Connection failed while doing a try.

from “suiteCRM.log” I get all of this: (Should I get more infor from phpmailer?? I’m not sure if I should look into other log files)

Tue Mar  8 10:14:21 2016 [24652][-none-][FATAL] Configuration variable date.timezone is not set, guessed timezone Europe/Berlin. Please set date.timezone="Europe/Berlin" in php.ini!
Tue Mar  8 10:18:23 2016 [26705][1][FATAL] SugarPHPMailer encountered an error: An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.
Tue Mar  8 10:18:23 2016 [26705][1][FATAL] SugarPHPMailer encountered an error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Tue Mar  8 10:18:23 2016 [27574][-none-][FATAL] Retrieving record by id users:1 found  Query Failed: SELECT users.* FROM users  WHERE users.id = '1' AND users.deleted=0 LIMIT 0,1: MySQL error 2006: MySQL server has gone away
Tue Mar  8 10:24:07 2016 [31779][1][FATAL] SugarPHPMailer encountered an error: An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.
Tue Mar  8 10:24:07 2016 [31779][1][FATAL] SugarPHPMailer encountered an error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Tue Mar  8 10:24:07 2016 [32687][-none-][FATAL] Retrieving record by id users:1 found  Query Failed: SELECT users.* FROM users  WHERE users.id = '1' AND users.deleted=0 LIMIT 0,1: MySQL error 2006: MySQL server has gone away

Thanks for your help!!

Thanks for highlighting this.

This is a known issue labelled as high priority on the SuiteCRM GitHub Repository.

I recommend you keep track of the issue for updates/fixes.

Thanks,

Will.

The thread is a bit old, but it might help someone.
After getting frustrated 2 weeks and trying all sorts of solutions from everywhere, I tried a simple/broad thing as a last effort.
I downloaded SugarCRM latest version and replaced phpmailer.php and smtp.php within Include/phpmailer/ folder (of course after taking a backup of old files).
and this worked a like a charm for me.

For me this works:

[quote]Managed to fix it @ghermans

In SuiteCRM folder go to /modules/Emails and find Email.php file
In there change

$mail->Mailer = “smtp”;
to
$mail->Mailer = “Sendmail”;

Should work.[/quote]

1 Like

Hi Guys

Jumping around this issue I have a strange one that has come up

I can add the smtp details, username password in the admin section email settings etc

Send test email - Received with no issues

I then match the settings for an inbound handling account and when attempting to send an email campaign the all stay inside the queue and won’t send

The following From address failed: info@XXX.com
Wed Jun 15 17:18:22 2016 [20663][b610930f-cf36-efb6-baa3-572c67e59886][FATAL] SMTP -> ERROR: Failed to connect to server. Code: 110 Reply: Connection timed out
Wed Jun 15 17:18:22 2016 [20663][b610930f-cf36-efb6-baa3-572c67e59886][FATAL] SugarPHPMailer encountered an error: The following From address failed: info@XXX.com
Wed Jun 15 17:18:22 2016 [20663][b610930f-cf36-efb6-baa3-572c67e59886][FATAL] Email delivery FAILURE:Array

Has anyone had the same?
Thanks

Similar issue again
Sending test works - but when attempting to send a campaign they sit in the email queue

View log has the following

Mon Jul 25 15:22:03 2016 [28084][e47327b5-b4bd-3515-c550-532327ed2440][FATAL] Email delivery error:Array
(
[date_entered] => 2016-07-25 14:17:21
[date_modified] =>
[user_id] => e47327b5-b4bd-3515-c550-532327ed2440
[id] => 174062
[campaign_id] => d07a4590-e56f-06d6-4567-57961da5d3ac
[marketing_id] => a15c9ad2-59d6-a0db-3852-57961ec24eb7
[list_id] => 794d71e8-f85e-c7d4-ae14-5649be8cd66e
[send_date_time] => 2016-07-25 11:15:00
[modified_user_id] =>
[in_queue] => 0
[in_queue_date] =>
[send_attempts] => 0
[deleted] => 0
[related_id] => e938bdc0-b77a-3e25-0fac-5530d51dc893
[related_type] => Contacts
)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Could you solve it?

i had the same issue, Version 7.7.5
i was using Gmail for connection,
Solved by “Less secure apps to TURN ON” in the gmail settings.

go here:
https://www.google.com/settings/security/lesssecureapps

:slight_smile:

It WORKS!!! Thanks RobB!!!

turned off SELinux and it worked perfectly… thank you

Just a quick note that I’ll be adding a bug issue in for. I just banged my head against a similar issue of this for entirely too long. It turns up that the forms for entering your smtp password in has a max length of 64 characters. If you were to say copy and paste a password of length 70 into this input field you would never know that the whole password didn’t make it in and therefore be trying to save a password which is cut off.

I’ve done a quick search of some RFCs and I can’t figure out why someone would choose a maxlength for password of 64 chars. It looks like it may just be a copy/paste of other form fields. The username of an email (local part) DOES have a max length of 64 chars according to the RFC; however, that’s not technically the same as an SMTP login as some require you to enter the full email address which would be the local + the domain.

Never the less, apparently 64 is too short as a very popular SMTP gateway gives you a password of 70 chars.

No bigge just insert into:

include/SugarPHPMailer.php:98

    $this->SMTPAutoTLS = false;
    $this->SMTPOptions = array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    );