0

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

scamp
  • 381
  • 2
  • 5
  • 14
  • What's the error? Any indication why it is refused? Any bounced back emails from gmail explaining why the email has not been received? – Debreczeni András Jun 04 '14 at 08:27
  • Seemingly the email has been sent properly. I've got any failure but I never received them neither in my spam folder. – scamp Jun 04 '14 at 08:30
  • Have you checked the mail logs for any trace if the email has really been sent? php mail functions tend to return true sometimes even if there's something fishy going on in the background. – Debreczeni András Jun 04 '14 at 08:35
  • I checked my prod log I've got nothing in it. I don't know where I can found my mail logs. – scamp Jun 04 '14 at 08:53
  • In `Ubuntu` it's found under `/var/log/mail.log` The prod.log may only refer to your symfony logging. Try `locate mail.log` in your console. – Debreczeni András Jun 04 '14 at 09:02
  • Yeah upon Ubuntu I know where to find it but I am working on W7 – scamp Jun 04 '14 at 09:11
  • Sorry, I am not really competent in that, but found a great article on how to set up sendmail properly in `WAMP` (if you are using that, hopefully): http://yogeshchaugule.com/blog/2013/configure-sendmail-wamp This article has some info on where the logging takes place. – Debreczeni András Jun 04 '14 at 09:17
  • Found this related Q/A that explains what you need to do: http://stackoverflow.com/questions/22396721/how-to-send-email-from-localhost-wamp-server-to-send-email-gmail-hotmail-or-so-f – Debreczeni András Jun 04 '14 at 09:24
  • Gmail blocks unconfigured mail servers. In the mail log you can find the error. Go to `cd /var/log` and do a `ls`. With `cat` and `tail` you can view the content. – Pi Wi Jun 04 '14 at 10:07
  • @Pi Wi : I am working on Windows. How can I access to mail log ? I've deployed my project on prod – scamp Jun 04 '14 at 11:15
  • I cannot access to my log upon my server. I've got a permission denied but I am still trying to find a way to solve that – scamp Jun 04 '14 at 11:48

0 Answers0