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.
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 āā
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.
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 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