Swiftmailer successfully sends but no mail received

风格不统一 提交于 2019-12-10 19:59:55

问题


I have made a simple contact form and use swiftmailer(with symfony2) to send and email.

Everything is fine when I'm using gmail account but on production it has to be a noreply address in website domain. So I changed parameters to correspond this email account.

It looks like it is working a send method return true but no message is received, i checked a spam folder but it didn't get there either. Settings are 100% correct as they work in thunderbird.

Have no idea where to look for a problem. Any suggestions what should I check?

I have tried to send email with PHPMailer using same account and it worked so it seems problem is just with swiftmailer. I'm sending emails in few more places in my project and would like to avoid changing it now but fix it instead.


回答1:


After checking logs the problem was found.

Emails were rejected because I was setting From filed to email provided by user. Server was rejecting them because this address don't belong to account I was sending from.




回答2:


By default the logging for swiftmailer is disabled in production. You can enable logging for swiftmailer in config.yml by adding a "logging: true" to the swiftmailer section as outlined here: http://symfony.com/doc/master/reference/configuration/swiftmailer.html#logging

Hopefully this will give you some more specific error messages to search on.



来源:https://stackoverflow.com/questions/15995847/swiftmailer-successfully-sends-but-no-mail-received

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!