I'm trying to send emails with Symfony 4, Wamp and fake sendmail on Windows 10 but without success, I'm hosted on OVH. I want to specify that I have a site hosted on OVH with same parameters running on Symfony 2 and Swiftmailer works perfectly.
Here is my Symfony .env line for Swiftmailer:
MAILER_URL=smtp://smtp.dnimz.com:465?encryption=ssl&auth_mode=login&[email protected]&password=***
Here is part of my Symfony controller for Swiftmailer:
$message = (new \Swift_Message('Hello Email'))
->setFrom(array($this->container->getParameter('mailer_user') => 'dnimz'))
->setTo($user->getEmail())
->setBody(
$this->renderView(
'emails/email_registration.html.twig',
array('username' => $user->getUsername())
),
'text/html'
);
try {
$this->get('mailer')->send($message);
$this->addFlash('notice', 'mail envoyé !');
} catch (\Exception $e) {
$this->addFlash(
'notice',
'<strong>Le message n\'a pu être envoyé !</strong>'
);
}
Here is my sendmail.ini from fake sendmail:
[sendmail]
smtp_server=smtp.dnimz.com
smtp_port=465
smtp_ssl=auto
error_logfile=error.log
[email protected]
auth_password=***
pop3_server=
pop3_username=
pop3_password=
force_sender=
force_recipient=
hostname=
Here is my php.ini mail function part:
SMTP =smtp.dnimz.com
smtp_port =465
sendmail_from = "[email protected]"
sendmail_path = "C:/wamp64/sendmail/sendmail.exe"
mail.add_x_header = On
When sending the email, I've got this warnings and error:
[debug] Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
2017-12-29T18:44:09+00:00 [debug] Warning: stream_socket_client(): Failed to enable crypto
2017-12-29T18:44:09+00:00 [debug] Warning: stream_socket_client(): unable to connect to ssl://smtp.dnimz.com:465 (Unknown error)
2017-12-29T18:44:09+00:00 [error] Exception occurred while flushing email queue: Connection could not be established with host smtp.dnimz.com [ #0]
I don't know why these errors occur?