I am working on CakePHP3 Save form after send email to user.
Gmail account receiving email without any obstacle but when sending email to Yahoo address. email not receiving on Yahoo account users.
I am using default Cake Email
class to send email provided by CakePHP 3. I did'nt do any other configuration for sending email just use below code.
Any help will be appropriated. Thanks in advance.
$email = new Email();
$email->setFrom(['me@example.com' => 'abc'])
->setTo('abc@yahoo.com')
->emailFormat('html')
->setSubject('Subject')
->send('Subject');
If your email is going out – which we know, since it is arriving on the Gmail account – and is not received by the Yahoo address, this most likely means, Yahoo decided that the sender ist not trustworthy. Please check the SPAM folder. This is not a CakePHP issue.
CakePHP uses the PHP mail
function by default. You could also use a trusted SMTP
server to deliver your mails, which will increase the chance of successful delivery.
If Gmail is receiving the email, but Yahoo isn't then it implies your email is being treated as Spam by Yahoo. There could be many reasons for Yahoo doing this (too many to go into here), but make sure you use a trusted SMTP server to deliver emails rather than rely on your server (CakePHP will use mail()
by default which isn't great). It is also a good idea to send both a text and HTML format email rather than just the latter; this is very doable in CakePHP.
You might find this article by Sendgrid useful: 10 Tips to Keep Email Out of the Spam Folder.
Especially for Yahoo (and good practice for any email sending) you will need proper server and identification setup for the mail to get to the user's inbox.
Are you using a local SMTP server? If so, the (external) IP address needs to be properly setup in an SPF record for the domain you are sending from.
You can signup for the Yahoo feedback loop and find out where your emails are going here - https://help.yahoo.com/kb/SLN3438.html