0

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('johndoe@gmail.com', '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.

  • Can you see the server logs on your mail server to see whether they help? Also you might want to look at a library like PHPMailer instead of the build-in `mail()` function as it can help if your server needs authentication for example. – droopsnoot Dec 21 '22 at 19:24
  • @droopsnoot Thank you! This helped me a lot. How can I mark your comment as the solution? – Sora Blank Dec 22 '22 at 12:59

1 Answers1

0

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.

Peter
  • 59
  • 3