I can send an email to myself with my professional email.
I even can send an email from my gmail email address to my professional email address.
But my problem is : Why swiftMailer doesn't send my email to gmail, hotmail addresses ? Is that a header matter ?
Config.yml file :
swiftmailer:
transport: sendmail
host: /usr/bin/sendmail
username: ~
password: ~
spool: { type: memory }
That's my function sendEmail()
$mailer = $this->get('mailer');
$message = \Swift_Message::newInstance()
->setSubject($subject)
->setContentType("text/plain; charset=UTF-8")
->setFrom('x.y@professional_domain.fr')
->setTo('XXX@gmail.com')
->setBody($body, 'multipart/alternative')
->addPart($body, 'text/html')
->addPart($bodyPlain, 'text/plain');
if (!$mailer->send($message, $failures)) {
echo "Failures:";
print_r($failures);
}
I hope you will understand.
Thanks