I have tried a few different methods, but php mail() and PHPMailer are not sending to my google workspace email addresses. They will send to my yahoo and gmail address, though.
My domain is in google domains, and the website is on GoDaddy. I also want to point out the google workspace email is NOT the same as the domain I'm using the contact forms on.
So far, I've tried adding txt SPF records for GoDaddy to my domain. I was told to use these two.
Host | Type | Data
@ | txt | "v=spf1 include:secureserver.net -all"
admin| txt | "v=spf1 include:secureserver.net -all"
These SPF records were given to me to use by GoDaddy reps.
I tested different php mail functions i've found online just to make sure it wasn't my code, and version 5.2 and 6.6 of PHPMailer. (I still have issues with PHPMailer SMTP but I'll tackle that after I get this issue fixed.)
The only other thing I can think of is trying this on a different server, but I don't have one to test on.
Has anyone ran into this issue? I'm at a loss.
Example Code:
ini_set('display_errors', 1);
error_reporting(E_ALL);
$from = 'Darth Vader <darth@empire.com>';
$to = 'Emperor <palpatine@empire.com>';
$subject = 'Force';
$message = 'There is a great disturbance in the Force.';
$headers = 'From: ' . $from;
if (!mail($to, $subject, $message, $headers))
{
echo "Error.";
}
else
{
echo "Message sent.";
}
Obviously with my own creds.
UPDATE
I also added DMARC to my txt record last night. I tested it 16 hours later, no luck.
I replaced my actual domain with the word "domain"
"v=DMARC1; p=none; rua=mailto:no-reply@domain; ruf=mailto:no-reply@domain; fo=1;"
source https://stackoverflow.com/questions/77115995/php-mail-function-not-working-with-google-workspace-email
No comments:
Post a Comment