PHPMailer on SLIM Framework not sending mails - php

I am having troubles with PHPMailer. on index.php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/PHPMailer/src/Exception.php';
require __DIR__ . '/PHPMailer/src/PHPMailer.php';
require __DIR__ . '/PHPMailer/src/SMTP.php'
$mail = new PHPMailer;
require __DIR__ . '/../controllers/login.php';
And login. php
$app->post('/proyectos/login', function ($request) use($servername, $dbname, $dbuser, $dbpassword, $mail)
{
$objTmp = $request->getBody();
$obj = array();
parse_str($objTmp, $obj);
$response = array();
$mail->SMTPDebug = 4;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'user#gmail.com';
$mail->Password = 'pass';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('oneemail#gmail.com', 'sender');
$mail->addAddress('someemail#gmail.com', 'receiver');
$mail->addReplyTo('anotheremail#gmail.com', 'Information');
$mail->isHTML(true);
$mail->Subject = 'Just a subject';
$mail->Body = "Just a body";
if(!$mail->send()) {
$response['success'] = false;
$response['message'] = "Could not send email.";
echo json_encode($response);
return;
}
$response['success'] = true;
echo json_encode($response);
return;
2017-12-01 19:54:33 Connection: opening to smtp.gmail.com:587, timeout=300, options=array()
2017-12-01 19:54:34 Connection: opened
2017-12-01 19:54:34 SMTP INBOUND: "220 smtp.gmail.com ESMTP g37sm1362021uah.16 - gsmtp"
2017-12-01 19:54:34 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP g37sm1362021uah.16 - gsmtp
2017-12-01 19:54:34 CLIENT -> SERVER: EHLO localhost
2017-12-01 19:54:34 SMTP INBOUND: "250-smtp.gmail.com at your service, [190.94.198.150]"
2017-12-01 19:54:34 SMTP INBOUND: "250-SIZE 35882577"
2017-12-01 19:54:34 SMTP INBOUND: "250-8BITMIME"
2017-12-01 19:54:34 SMTP INBOUND: "250-STARTTLS"
2017-12-01 19:54:34 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2017-12-01 19:54:34 SMTP INBOUND: "250-PIPELINING"
2017-12-01 19:54:34 SMTP INBOUND: "250-CHUNKING"
2017-12-01 19:54:34 SMTP INBOUND: "250 SMTPUTF8"
2017-12-01 19:54:34 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [190.94.198.150]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2017-12-01 19:54:34 CLIENT -> SERVER: STARTTLS
2017-12-01 19:54:34 SMTP INBOUND: "220 2.0.0 Ready to start TLS"
2017-12-01 19:54:34 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2017-12-01 19:54:34 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [C:\xampp\htdocs\proyectos\public\PHPMailer\src\SMTP.php line 404]
SMTP Error: Could not connect to SMTP host.
2017-12-01 19:54:34 CLIENT -> SERVER: QUIT
2017-12-01 19:54:34
2017-12-01 19:54:34
2017-12-01 19:54:34
2017-12-01 19:54:34 Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
{"success":false,"message":"Could not send email."}

Related

How to implement Oauth 2.0 in PHPMailer for Exchange Online

As many of you are aware, Microsoft is deprecating basic authentication (login and password) for Exchange online on 01/10/2022 onwards. You can read the full article over here:
https://www.microsoft.com/en-us/microsoft-365/blog/2022/09/01/microsoft-retires-basic-authentication-in-exchange-online/#:~:text=As%20previously%20announced%2C%20we%20are,users%20move%20to%20Modern%20Authentication
I am currently using PHPMailer to send e-mails via SMTP from an application.
Working example of the current code:
<?php
include "vendor/autoload.php";
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->Host = "smtp.office365.com";
$mail->Port = "587";
$mail->SMTPAuth = true;
$mail->Username = "my_email#my-company.com";
$mail->Password = "my_password";
$mail->SMTPSecure = "tls";
$mail->From = "my_email#my-company.com";
$mail->FromName = "my_name";
$mail->AddAddress("my_email#my-company.com");
$mail->IsHTML(true);
$mail->Subject = "This is a test subject";
$mail->Body = "Hello, how are you?";
$mail->Send();
?>
I want to transfer from basic authentication to OAuth 2.0. After reading a lot of documentation, searching the web for 3 days, trying and trying, I am not able to get it working.
Example of my new code:
<?php
include "vendor/autoload.php";
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\OAuth;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = "smtp.office365.com";
$mail->SMTPAuth = true;
$mail->AuthType = "XOAUTH2";
$mail->SMTPDebug = SMTP::DEBUG_LOWLEVEL;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$username = "my_email#my-company.com";
$clientId = "client_id_from_azure_app_registration";
$clientSecret = "client_secret_from_azure_app_registration";
$redirectURI = "my_redirect_uri";
$Token = "my_token";
$mail->refresh_token = $Token;
$provider = new Stevenmaguire\OAuth2\Client\Provider\Microsoft(
[
"clientId" => $clientId,
"clientSecret" => $clientSecret,
"redirectUri" => $redirectURI
]
);
$provider->urlAPI = "https://outlook.office365.com/.default";
$provider->scope = "Mail.Send";
$mail->setOAuth(
new OAuth(
[
"provider" => $provider,
"clientId" => $clientId,
"clientSecret" => $clientSecret,
"refreshToken" => $Token,
"userName" =>$username
]
)
);
$mail->From = $username;
$mail->AddAddress("my_email#my-company.com");
$mail->IsHTML(true);
$mail->Subject = "This is a test subject";
$mail->Body = "Hello, how are you?";
$mail->Send();
?>
I generate an access token via Postman and use this token in the code above:
The application is configured in Microsoft Azure with the required permissions:
This is the output I get:
2022-09-27 13:51:38 Connection: opening to smtp.office365.com:587, timeout=300, options=array()
2022-09-27 13:51:38 Connection: opened
2022-09-27 13:51:38 SMTP INBOUND: "220 AS4P191CA0011.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 27 Sep 2022 13:51:37 +0000"
2022-09-27 13:51:38 SERVER -> CLIENT: 220 AS4P191CA0011.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 27 Sep 2022 13:51:37 +0000
2022-09-27 13:51:38 CLIENT -> SERVER: EHLO
2022-09-27 13:51:38 SMTP INBOUND: "250-AS4P191CA0011.outlook.office365.com Hello [2a02:4780:8:2::25]"
2022-09-27 13:51:38 SMTP INBOUND: "250-SIZE 157286400"
2022-09-27 13:51:38 SMTP INBOUND: "250-PIPELINING"
2022-09-27 13:51:38 SMTP INBOUND: "250-DSN"
2022-09-27 13:51:38 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2022-09-27 13:51:38 SMTP INBOUND: "250-STARTTLS"
2022-09-27 13:51:38 SMTP INBOUND: "250-8BITMIME"
2022-09-27 13:51:38 SMTP INBOUND: "250-BINARYMIME"
2022-09-27 13:51:38 SMTP INBOUND: "250-CHUNKING"
2022-09-27 13:51:38 SMTP INBOUND: "250 SMTPUTF8"
2022-09-27 13:51:38 SERVER -> CLIENT: 250-AS4P191CA0011.outlook.office365.com Hello [2a02:4780:8:2::25]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-09-27 13:51:38 CLIENT -> SERVER: STARTTLS
2022-09-27 13:51:38 SMTP INBOUND: "220 2.0.0 SMTP server ready"
2022-09-27 13:51:38 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2022-09-27 13:51:38 CLIENT -> SERVER: EHLO
2022-09-27 13:51:38 SMTP INBOUND: "250-AS4P191CA0011.outlook.office365.com Hello [2a02:4780:8:2::25]"
2022-09-27 13:51:38 SMTP INBOUND: "250-SIZE 157286400"
2022-09-27 13:51:38 SMTP INBOUND: "250-PIPELINING"
2022-09-27 13:51:38 SMTP INBOUND: "250-DSN"
2022-09-27 13:51:38 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2022-09-27 13:51:38 SMTP INBOUND: "250-AUTH LOGIN XOAUTH2"
2022-09-27 13:51:38 SMTP INBOUND: "250-8BITMIME"
2022-09-27 13:51:38 SMTP INBOUND: "250-BINARYMIME"
2022-09-27 13:51:38 SMTP INBOUND: "250-CHUNKING"
2022-09-27 13:51:38 SMTP INBOUND: "250 SMTPUTF8"
2022-09-27 13:51:38 SERVER -> CLIENT: 250-AS4P191CA0011.outlook.office365.com Hello [2a02:4780:8:2::25]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-09-27 13:51:38 Auth method requested: XOAUTH2
2022-09-27 13:51:38 Auth methods available on the server: LOGIN,XOAUTH2
Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: Bad Request in /home/u760208683/vendor/stevenmaguire/oauth2-microsoft/src/Provider/Microsoft.php:79 Stack trace: #0 /home/u760208683/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628): Stevenmaguire\OAuth2\Client\Provider\Microsoft->checkResponse(Object(GuzzleHttp\Psr7\Response), Array) #1 /home/u760208683/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request)) #2 /home/u760208683/vendor/phpmailer/phpmailer/src/OAuth.php(115): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\RefreshToken), Array) #3 /home/u760208683/vendor/phpmailer/phpmailer/src/OAuth.php(128): PHPMailer\PHPMailer\OAuth->getToken() #4 /home/u760208683/vendor/phpmailer/phpmailer/src/SMTP.php(598): PHPMailer\PHPMailer\OAuth->getOauth64() #5 /home/u760208683/vendor/phpmailer/phpmailer/src/PHPMailer in /home/u760208683/vendor/stevenmaguire/oauth2-microsoft/src/Provider/Microsoft.php on line 79
Can anyone point me in the right direction?
Many thanks in advance!
Kind regards,
Laurents
Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException:
This error is due to the fact you are providing an access_token to send the mail instead of a refresh_token.
First of all, add the scope offline_access to get a refresh_token in your authorise url and save it somewhere in your app ( expiration is 24 hour or 90 days depends on type of app)
once you have the refresh token you can send as many mails as you want with the same token.
you can get new one by providing another non expired refresh token in the url and change grant_type to refresh_token and add the key refresh_token.

Failed to connect to SMTP using PHPMailer

I have tried to connect using SMTP, but failed. Here is my code.
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = 20;
$mail->isSMTP();
$mail->Host = 'smtp.mail.yahoo.com';
$mail->SMTPAuth = true;
$mail->AuthType = 'LOGIN';
$mail->Username = 'david_thedragonzzz#yahoo.com';
$mail->Password = 'secret';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->setFrom('david_thedragonzzz#yahoo.com', 'Mailer');
$mail->addAddress('david_thedragonzzz#yahoo.com', 'User');
$mail->addReplyTo('test#yahoo.com', 'Information');
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
The result
2018-02-07 10:45:43 Connection: opening to ssl://smtp.mail.yahoo.com:465, timeout=300, options=array()
2018-02-07 10:45:43 Connection: opened
2018-02-07 10:45:43 SMTP INBOUND: "220 smtp.mail.yahoo.com ESMTP ready"
2018-02-07 10:45:43 SERVER -> CLIENT: 220 smtp.mail.yahoo.com ESMTP ready
2018-02-07 10:45:43 CLIENT -> SERVER: EHLO localhost
2018-02-07 10:45:43 SMTP INBOUND: "250-smtp.mail.yahoo.com"
2018-02-07 10:45:43 SMTP INBOUND: "250-PIPELINING"
2018-02-07 10:45:43 SMTP INBOUND: "250-SIZE 41697280"
2018-02-07 10:45:43 SMTP INBOUND: "250-8 BITMIME"
2018-02-07 10:45:43 SMTP INBOUND: "250 AUTH PLAIN LOGIN XOAUTH2 XYMCOOKIE OAUTHBEARER"
2018-02-07 10:45:43 SERVER -> CLIENT: 250-smtp.mail.yahoo.com250-PIPELINING250-SIZE 41697280250-8 BITMIME250 AUTH PLAIN LOGIN XOAUTH2 XYMCOOKIE OAUTHBEARER
2018-02-07 10:45:43 Auth method requested: LOGIN
2018-02-07 10:45:43 Auth methods available on the server: PLAIN,LOGIN,XOAUTH2,XYMCOOKIE,OAUTHBEARER
2018-02-07 10:45:43 CLIENT -> SERVER: AUTH LOGIN
2018-02-07 10:45:43 SMTP INBOUND: "334 VXNlcm5hbWU6"
2018-02-07 10:45:43 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2018-02-07 10:45:43 CLIENT -> SERVER: xxx==
2018-02-07 10:45:43 SMTP INBOUND: "334 UGFzc3dvcmQ6"
2018-02-07 10:45:43 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2018-02-07 10:45:43 CLIENT -> SERVER: xxx==
2018-02-07 10:45:46 SMTP INBOUND: "535 5.7.0 (#MBR1212) Incorrect username or password."
2018-02-07 10:45:46 SERVER -> CLIENT: 535 5.7.0 (#MBR1212) Incorrect username or password.
2018-02-07 10:45:46 SMTP ERROR: Password command failed: 535 5.7.0 (#MBR1212) Incorrect username or password.
SMTP Error: Could not authenticate.
2018-02-07 10:45:46 CLIENT -> SERVER: QUIT
2018-02-07 10:45:46 SMTP INBOUND: "221 2.0.0 Bye"
2018-02-07 10:45:46 SERVER -> CLIENT: 221 2.0.0 Bye
2018-02-07 10:45:46 Connection: closed
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.
I can't understand how come this code gives me "incorrect username or password" error. I have configured smtp using Mozilla Thunderbird. Username and Password is right, but still gives me this kind of error.

PHPMailer connection Failed

I'm using digital ocean.
I've been digging to fix this error.
2016-10-26 04:35:35 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP ht5sm340860pad.16 - gsmtp
2016-10-26 04:35:35 CLIENT -> SERVER: EHLO example.com 2016-10-26 04:35:35 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [128.199.201.169] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8
2016-10-26 04:35:35 CLIENT -> SERVER: STARTTLS
2016-10-26 04:35:35 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2016-10-26 04:35:35 SMTP Error: Could not connect to SMTP host.
2016-10-26 04:35:35 CLIENT -> SERVER: QUIT
2016-10-26 04:35:36 SERVER -> CLIENT:
2016-10-26 04:35:36 SMTP ERROR: QUIT command failed:
2016-10-26 04:35:36 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
There was an error! Try again
Here is my setting:
require 'mailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 2;
$mail->isSMTP();
// Specify main and backup SMTP servers
$mail->Host = gethostbyname('smtp.gmail.com');
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'mail#gmail.com'; // SMTP username
$mail->Password = 'psw'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('d#gmail.com', 'd');
$mail->addAddress('test#gmail.com', ''); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = " Account Confirmation";
$mail->Body = "Hello. test Thank you for you using our service! To activate your account, please access this link:\n <a href='http://w2heaven.com/index.php?confirmcode=$confirmcode'>Click here</a> \n";
if(!$mail->send()) {
echo "There was an error! Try again";
} else {
echo "Please confirm your email at: blablah";
}
More info: It works without gethostbyname(); but extremely slow because DigitalOcean blocks IPv6

Can't send mail through exec in PHP

I'm trying to send an email and I have 2 scripts:
send.php
<?php
require_once 'PHPMailerAutoload.php';
require_once 'class.phpmailer.php';
require_once 'class.smtp.php';
$mail = new PHPMailer();
$body = " ";
$mail->IsSMTP();
$mail->SMTPDebug = 4;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Username = "XXXXXXXX#gmail.com";
$mail->Password = "XXXXXXXX";
$mail->Subject = "TEST";
$mail->MsgHTML($body);
$address = "YYYYYYYY#gmail.com";
$mail->AddAddress($address, "");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
script.php
<?php
echo shell_exec("php send.php");
?>
By calling directly send.php in browser, the email is send. Problem is when I'm calling script.php, then the email is not send and Im getting an error. Here are last lines from output:
2016-02-09 19:19:55 Connection: opening to smtp.gmail.com:587, t=300, opt=array (
)
2016-02-09 19:19:55 Connection: opened
2016-02-09 19:19:55 SMTP -> get_lines(): $data was ""
2016-02-09 19:19:55 SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP cc7sm606507lbd.11 - gsmtp
"
2016-02-09 19:19:55 SMTP -> get_lines(): $data is "220 smtp.gmail.com ESMTP cc7sm606507lbd.11 - gsmtp
"
2016-02-09 19:19:55 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP cc7sm606507lbd.11 - gsmtp
2016-02-09 19:19:55 CLIENT -> SERVER: EHLO raspberrypi
....
Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in /var/www/html/class.smtp.php on line 325
2016-02-09 19:19:55 CLIENT -> SERVER: QUIT
2016-02-09 19:19:56 SMTP -> get_lines(): $data was ""
2016-02-09 19:19:56 SMTP -> get_lines(): $str is "�F"
2016-02-09 19:19:56 SMTP -> get_lines(): $data is "�F"
2016-02-09 19:19:56 SERVER -> CLIENT: �F
2016-02-09 19:19:56 SMTP ERROR: QUIT command failed: �F
2016-02-09 19:19:56 Connection: closed
2016-02-09 19:19:56 SMTP connect() failed.
Mailer Error: SMTP connect() failed.
What can be causing this issue? Im using PHP7

PHPMailer - SMTP Error: Could not connect to SMTP host

I'm trying to send email using PHPMailer. When I tried sending the email from gmail account, it works perfectly fine. However, I would like to send the email from my own SMTP, but there seems to be an error. What could be the problem? Please help me. Thank you.
Using smtp.gmail.com :
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'myemail#gmail.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
Using mail.distech.com.my :
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = 'mail.distech.com.my';
$mail->SMTPAuth = true;
$mail->Username = 'myemail#distech.com.my';
$mail->Password = 'password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->From = 'myemail#distech.com.my';
$mail->addAddress('amalina#distech.com.my');
$mail->Subject = 'Test';
$mail->Body = 'Test message';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
Error using mail.distech.com.my
2015-06-23 06:58:45 Connection: opening to mail.distech.com.my:587, timeout=300, options=array ( )
2015-06-23 06:58:45 Connection: opened
2015-06-23 06:58:45 SERVER -> CLIENT: 220-server.firstonline-server16.com ESMTP Exim 4.85 #2 Tue, 23 Jun 2015 14:58:45 +0800 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2015-06-23 06:58:45 CLIENT -> SERVER: EHLO 192.168.1.20
2015-06-23 06:58:46 SERVER -> CLIENT: 250-server.firstonline-server16.com Hello 192.168.1.20 [115.135.120.220] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP
2015-06-23 06:58:46 CLIENT -> SERVER: STARTTLS
2015-06-23 06:58:46 SERVER -> CLIENT: 220 TLS go ahead
Warning: stream_socket_enable_crypto() [function.stream-socket-enable-crypto]: SSL: The operation completed successfully. in C:\xampp\htdocs\ehars\phpmailer\class.smtp.php on line 344
2015-06-23 06:58:46 SMTP Error: Could not connect to SMTP host.
2015-06-23 06:58:46 CLIENT -> SERVER: QUIT
Notice: fwrite() [function.fwrite]: send of 6 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. in C:\xampp\htdocs\ehars\phpmailer\class.smtp.php on line 937
2015-06-23 06:58:46 SERVER -> CLIENT:
2015-06-23 06:58:46 SMTP ERROR: QUIT command failed:
2015-06-23 06:58:46 Connection: closed 2015-06-23 06:58:46 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
UPDATE :
Checked my phpinfo () and the ssl has been enabled.

Categories