Error:SMTP connect() failed.


I’m unable to get mail sending working with my new suiteCRM 7.6.3 installed on Linux Debian 8.3.

I have tried with a google account and with a mailbox of my provider, no way.

Found that thread:

But as a newbye , this is not very clear to me where to start !
So if smb encountered the same problem, I would be very graceful if he could share his experience.

Thank you and have a good day B)



I reply to me - I upgraded from 7.6.3 to 7.6.4 but there was no improvement: I’m still unable to use the mail sending.

Meilleures salutations,


using a clone machine which is configured with a non authenticate smtp server works. Seems to be related to secure authentication process.

Meilleures salutations,

I’m in the same boat. I’ve tried everything (I think). I’ve even been working for hours with my shared host provider. SuiteCRM worked perfectly (emails) before I migrated providers which is why I have been focusing there.

I have:
-upgraded to 7.6
-turned my phpmailer thing to ‘false’ (it’s in some post somewhere related to forcing TLS when certificates don’t match)
-i have tried a gmail account and a non-gmail account
-I have increased my error reporting to look at more details

I have, however, noticed that there is also a cron job fail at the same time. Could the two be related? I am not smart enough to know but it is interesting. Here are my errors:

All I know is that my life isn’t very good when suitecrm notifications and workflow notifications aren’t working. Someone! Save me!

Since after a few weeks without managing to make this work we had an urgency to send an email campaign we edited directly the file include/phpmailer/class.smtp.php at around line 273 just before the following code:

        if ($streamok) {
            $socket_context = stream_context_create($options);
            //Suppress errors; connection failures are handled at a higher level
            $this->smtp_conn = @stream_socket_client(
                $host . ":" . $port,

We hardcoded our required information for host and port and it suddenly worked.

The problem is that we have to re-edit it back as soon as we have finished sending the camapign otherwise all emails are sent with the wrong server.

Hi Amariussi,

I’m very glad someone else (you) is working on this. I’m unfortunately not able to code like you can. I’m very desperate to make this work as I have made suitecrm my only crm and I have recommended to several other businesses who also have this issue.

I cannot even send a password reset to a user becasue the system won’t allow any emails to be sent at all.

I’m not sure what to do next. I have read these posts and none of them have fixed my issue:


It seems like this issue is very real and obviously of the highest importance because without email capability the crm is dead for any workflow or notifications!

Let me know how I can help. I will help!

Thanks everyone!

Hi wayneotthere,

my solution is not a very good solution because it goes straight in the code.

However you can try it.

This is how you should proceed.

  1. make a copy of the file called include/phpmailer/class.smtp.php and call it include/phpmailer/original.class.smtp.php (if what we are doing doesn’t work you just have to delete the mofified file and rename this file to the previous name: just remove “original.” from the name)
  2. After you have created a copy edit the file called include/phpmailer/class.smtp.php: go to the line before the code I mentioned and write the following:
    $host = ‘mysmtphost’;
    $port = myportnumber;

You have to replace mysmtphost with your actual smtp host. It should be something like and myportnumber with your actual port number, for example 587.
So your edit would be:
$host = ‘’;
$port = 587;

Save the file and try. Possibly you will have to run a quick repair and rebuild before.

Then post if it has worked. If not I suggest that you restore the old file.

It would also be preferrable that you take a full back-up of your files and database.

even i tried this method but the outbound is not working for me.

I’m wondering if anyone encountered a definite solution from this problem yet. I got the same problem.

Tried different hosts and ports, nothing works. Whatever I try, it keeps on saying “SMTP connect() failed”…

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:

try it,

Thanks for the tip. Tried it but unfortanetaly it doesn’t solve the problem for me

in case of gmail

should be TLS 587

"From" Address: (should be the gmail one)

Allow users to use this account for outgoing email (checked)

Less secure apps to TURN ON" in the gmail settings.

This should work.

u have to check open ports first, 587 or 465 should not be used under any other application.