Can someone explain to me how work SSL AND STARTTLS with PHP ?
Il have a dedicated server with Postfix and Dovecot (managed by plesk). I don't have SSL.
To get and send my emails, I use SMTP/IMAP with STARTTLS.
But in PHP, with Swiftmailer and Symfony, I only have two options : ssl or tls. None of the 2 work in my case, emails do not leave.
Searching on stackoverflow, I put this in my code and this working :
$transport = \Swift_SmtpTransport::newInstance('smtp.server.fr', 587, 'tls')
->setUsername($username)
->setPassword($password)
->setStreamOptions(array('ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)));
$mailer = \Swift_Mailer::newInstance($transport);
Do you think my configuration is correct?