Smtp connection Failed Error in Suitecrm 7.9.4

Hi

Using Suitecrm 7.9.4
Sugar Version 6.5.24

Getting Smtp connection failed error when tried to send a test mail with provided smtp details

[32410][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.
[32410][1][FATAL] SugarPHPMailer encountered an error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.

Faced above error even after configuring outgoing mail server and not able to send mail.

Faced same issue with the Suitecrm 7.9.1
Now using 7.9.4 but the issue exists in this version also.

Any suggestions help on this ā€¦?

Please run the script I provide in this GitHub Issue:

https://github.com/salesagility/SuiteCRM/issues/4146

(Iā€™m called pgorod there)

And post here the full results of the output (inside the forumā€™s code tags).

If you have the same error as mruch2 there, you can try the proposed fix using SMTPOptions. But weā€™re still testing that to see if it really works.

Hi ,

Thank you for your reply .

I executed the script you gave inside suitecrm folder on live ip . Used gmail smtp details but faced same error . Actually we have our smtp mail server , using those credentials also faced same smtp connection failed error .

Tried with the proposed solution (Github thread) , but no use .Still the issue exists.

<?php require_once 'include/phpmailer/class.phpmailer.php'; require_once 'include/phpmailer/class.smtp.php'; $mail = new PHPMailer; $mail->SMTPDebug=14; $mail->Debugoutput='html'; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com';// // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'example@gmail.com'; // SMTP username $mail->Password = '1234abc'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->Port = 587; $mail->From = 'example@gmail.com'; $mail->FromName = 'example'; $mail->addAddress('toaddress@gmail.com', 'abc'); // Add a recipient $mail->addReplyTo('replyto@gmail.com', 'xyz'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); $mail->WordWrap = 50; // Set word wrap to 50 characters //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } ?>

Output:

Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
Connection: opened
SMTP -> get_lines(): $data is ā€œā€
SMTP -> get_lines(): $str is "220-privatemail.benchmarklists.com ESMTP Exim 4.89 #1 Mon, 04 Sep 2017 05:00:59 -0400 "
SMTP -> get_lines(): $data is "220-privatemail.benchmarklists.com ESMTP Exim 4.89 #1 Mon, 04 Sep 2017 05:00:59 -0400 "
SMTP -> get_lines(): $str is "220-We do not authorize the use of this system to transport unsolicited, "
SMTP -> get_lines(): $data is "220-privatemail.benchmarklists.com ESMTP Exim 4.89 #1 Mon, 04 Sep 2017 05:00:59 -0400 220-We do not authorize the use of this system to transport unsolicited, "
SMTP -> get_lines(): $str is ā€œ220 and/or bulk e-mail.ā€
SERVER -> CLIENT: 220-privatemail.benchmarklists.com ESMTP Exim 4.89 #1 Mon, 04 Sep 2017 05:00:59 -0400 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
CLIENT -> SERVER: EHLO 192.168.1.31
SMTP -> get_lines(): $data is ā€œā€
SMTP -> get_lines(): $str is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]ā€
SMTP -> get_lines(): $data is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]ā€
SMTP -> get_lines(): $str is ā€œ250-SIZE 52428800ā€
SMTP -> get_lines(): $data is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]250-SIZE 52428800ā€
SMTP -> get_lines(): $str is ā€œ250-8BITMIMEā€
SMTP -> get_lines(): $data is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]250-SIZE 52428800250-8BITMIMEā€
SMTP -> get_lines(): $str is ā€œ250-PIPELININGā€
SMTP -> get_lines(): $data is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]250-SIZE 52428800250-8BITMIME250-PIPELININGā€
SMTP -> get_lines(): $str is ā€œ250-AUTH PLAIN LOGINā€
SMTP -> get_lines(): $data is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGINā€
SMTP -> get_lines(): $str is ā€œ250-STARTTLSā€
SMTP -> get_lines(): $data is ā€œ250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLSā€
SMTP -> get_lines(): $str is ā€œ250 HELPā€
SERVER -> CLIENT: 250-privatemail.benchmarklists.com Hello 192.168.1.31 [192.168.1.21]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
CLIENT -> SERVER: STARTTLS
SMTP -> get_lines(): $data is ā€œā€
SMTP -> get_lines(): $str is ā€œ220 TLS go aheadā€
SERVER -> CLIENT: 220 TLS go ahead
SMTP Error: Could not connect to SMTP host.
CLIENT -> SERVER: QUIT
SMTP -> get_lines(): $data is ā€œā€

SMTP -> get_lines(): $str is ā€œā€

Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

I have this issue also. I installed a new version of SuiteCRM using a Bitanami instance on AWS. I have changed my Google settings to allow less secure applications. But emails are not getting sent.

Would changing the SSL certificates on the instance as per this link be worth trying https://community.bitnami.com/t/suite-crm-ssl-certificate-installation/50111

I am not a developer (I read the thread on Github referred above, and followed some of it, but lots went way over my head) so am not sure I can add any help to debug this.

I had this error on a new install. Version 7.9.4 running on a Bitnami instance on AWS. I found that by following the troubleshooting tips here

https://docs.bitnami.com/aws/apps/suitecrm/#troubleshooting-gmail-smtp-issues

I was able to fix it in particular as well as turning on access to less secure apps the step where

Browse to the ā€œUnlock Captchaā€ function page and sign in with your Gmail username and password.

was the one that made it start working for me. (The unlock Captcha function page is https://accounts.google.com/b/0/DisplayUnlockCaptcha

1 Like

Iā€™ve added around line 79 in include/SugarPHPMailer.php

$this->SMTPOptions = array(
ā€˜sslā€™ => array(
ā€˜verify_peerā€™ => false,
ā€˜verify_peer_nameā€™ => false,
ā€˜allow_self_signedā€™ => true
)
);

Works like a charmā€¦for further reading:
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#php-56-certificate-verification-failure

Of courseā€¦better to add a valid ssl certificate.

Hope it Helpsā€¦

Hi all
I installed version 7.9.6 and had the error:
SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.

I tried several workarounds I found in the forum, like changing files in the include-folder, hardcoding my server settings, trying all combinations in the UI (with port 465, 587, 25 and with SSL, TLS, None) etc etc.
None of these fixed my error.

Now, I finally found a solution, posting it to enable other users to try this fix, if they are fighting with the outgoing email settings:
ā€“> Use n email password which is just made up of a-z, A-Z, 0-9. So, DONT use special characters like +=(),. and so on

I had a complex password with special chars. Changing this fixed it for me :slight_smile:

Hope it helps someone, too

1 Like

I tried changing the password but that didnā€™t do anything.

What worked for me is to change back from SSL/TLS to none and use port 2525.

And sometimes the problem is in the php settings. SuiteCRM works with older settings, 7.0.33

1 Like