Send Email with PHP on XAMPP

152 views Asked by At

I'm trying to send an email from no-reply@{domain} to my Gmail mailbox. I don't get any Error, the Email just doesn't arrive at my Gmail mailbox.

My PHP code looks like this:

<?php mail('[email protected]', 'Test Email', 'Hello World', 'From: John Doe <no-reply@{domain}>'); ?>

I've set the php.ini like this:

[mail function]
SMTP=mail.{domain}
smtp_port=25
sendmail_from=no-reply@{domain}
mail.add_x_header=Off

And in the DNS settings of my domain, I have an MX @ 10 mail.{domain} entry. I don't know if that's important, but I have hMailServer installed. Recieving Emails works already.

1

There are 1 answers

0
Peter On

I think it's the mailprotection from google self. Here you can get more information about it: https://support.google.com/mail/answer/81126?hl=en

Important: Starting November 2022, new senders who send email to personal Gmail accounts must set up either SPF or DKIM. Google performs random checks on new sender messages to personal Gmail accounts to verify they’re authenticated. Messages without at least one of these authentication methods will be rejected or marked as spam. This requirement doesn’t apply to you if you’re an existing sender. However, we recommend you always set up SPF and DKIM to protect your organization’s email and to support future authentication requirements.