SMTP connect failed. Using SSL cerificate

Hi,
SMTP connect failed after installing ssl certificate. With out ssl cerificate mail is working but after configure ssl certificate it is not working and i am using office365 mail configuration. Please help me to resolve this issue.

Thanks,

Kanagaraj S

There is an SMTP debugging technique explained here:

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/16507-mail-stopped-working-error-smtp-connect-failed#55682

Warning: don’t post results from those logs here on the forums, they contain your passwords. Obfuscate first.

1 Like

Hi Pgr,
Send mail function not executing after this line,


public function send() {
   $GLOBALS['log']->fatal("------------ Entering SugarMailer send");
        $this->phpMailerFullLog='';
//Use these to override some fields for tests:
//$this->From = 'me@here.com';
//$this->Sender = 'me@here.com';
//$this->Password='wrong';
//$this->FromName = 'My Name';
        $GLOBALS['log']->fatal("PHPMailer Send Function override: { FromName: $this->FromName From: $this->From Host: $this->Host UserName: $this->Username }");

How to resolve this?. Please help me resolve this issue.

Many people have used that code without problems, are you sure you copied it correctly?

Anyway, if the line you mention is the logging line, you can just comment out that line (just start the line with // ). There will be one less message in the log, but the SMTP log will be there.

Also, when you have such a PHP error, you need to check your php_errors.log to see what happened.

BTW, what is your version of SuiteCRM?

I am using suitecrm 7.6.4 version. I copied all the code mention in that link.

I never tested it with such an old version, maybe there’s some small difference. The php_errors.log log should tell you what’s wrong, and it should be easy to fix.

I would appreciate it if you could try to debug this, I want to include this code in the next SuiteCRM version and I would like to know if it breaks in old versions, and why. Thanks

After configured email settings i got given below error.

I am using office365 mail configuration and certification type using SSL port 587.

Please help me to resolve this issue.

Thanks

I would like to see what your php_errors.log says at the time when my debug code runs and fails.

Hi ,
While executing debug code, php error log given below lines are catcing,

PHP version needs to be 5.5 or greater for my code to work, I think that is what’s wrong, you have an older version, right?

I am using PHP version 5.6.24. Please help me to resolve this issue. I tried many ways but not able to send mail. Here mail is very very important.

Kindly help me.

Please tell me exactly which line in the code is line 1444 in opt/lampp/htdocs/CRM/include/phpmailer/class.phpmailer.php

The line numbers in my file might be a little different from your, and I’d like to know exactly which one is throwing the error.

Inside the smtpConnect function. Given below code is the line no 1444 in opt/lampp/htdocs/CRM/include/phpmailer/class.phpmailer.php


    $hello = $this->serverHostname();

The value it doesn’t like is coming from this function:


    protected function serverHostname()
    {
        $result = 'localhost.localdomain';
        if (!empty($this->Hostname)) {
            $result = $this->Hostname;
        } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
            $result = $_SERVER['SERVER_NAME'];
        } elseif (function_exists('gethostname') && gethostname() !== false) {
            $result = gethostname();
        } elseif (php_uname('n') !== false) {
            $result = php_uname('n');
        }
        return $result;
    }

So, what are you passing it in this->Hostname?

Did you set your host name in config.php, settings site_url and host_name? Mine are like this:


  'host_name' => 'www.myhost.org',
  'site_url' => 'http://www.myhost.org',

Yes, I given in that configuration file.

Now i removed your code file from sugarphpmailer.php and i got this error in error_log file,

testOutboundEmail.php line 75,


$email = new Email();
$out = $email->sendEmailTest($_REQUEST['mail_smtpserver'], $_REQUEST['mail_smtpport'], $_REQUEST['mail_smtpssl'],
        							($_REQUEST['mail_smtpauth_req'] == 'true' ? 1 : 0), $_REQUEST['mail_smtpuser'],
        							$pass, $_REQUEST['outboundtest_from_address'], $_REQUEST['outboundtest_to_address'], $_REQUEST['mail_sendtype'], $_REQUEST['mail_from_name']);

$out = $json->encode($out);

I’m sorry, it’s very hard to help from a distance. Do you have anybody there that knows more PHP than you? There is something in my code that works fine in other systems (SuiteCRM 7.8 and 7.9 and 7.10) but fails in your yours. It’s probably just a detail…

But you need to be able to check the values and types of variables, which I can’t do from here…

Thanks for helping.

Finally SuiteCRM 7.6.4 version option i enabled sendmail option.

I tried gmail and all other mails mail is going properly except Exchange(Office365) mail id’s not receiving any emails. But alert showing success.

Do you mean you can’t send from accounts using Exchange as an SMTP server?

Or do you mean you can’t send from any of your accounts TO some people who have office365 email addresses?

1 Like

Only those are all having office365 mail id.

Thank you

Thanks pgr.

Email Issue has been resolved.