VIA SPF Email Authentication

Well, I can’t figure it out. I use PHPMailer to send email from my domain - example.com myself. I am sending an email to myself (Google markup markup testing), but the emails are not authenticated. Here is the code that I use to send email to myself.

$mail = new PHPMailer(); $mail->isSMTP(); $mail->SMTPDebug = 2; $mail->Host = 'tls://smtp.gmail.com'; $mail->Port = 587; $mail->SMTPAuth = true; $mail->SMTPSecure = 'tls'; $mail->Username = ' myemail@gmail.com '; $mail->Password = ''; $mail->setFrom(' myemail@gmail.com '); $mail->addAddress(' myemail@gmail.com '); $mail->Subject = 'Microdata Test'; $html = ' <html> <head> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "EmailMessage", "description": "Check this out", "potentialAction": { "@type": "ViewAction", "target": "https://www.youtube.com/watch?v=eH8KwfdkSqU" } } </script> </head> <body> <p> This a test for a Go-To action in Gmail. </p> </body> </html> '; $mail->msgHTML($html); $mail->send(); 

Here is my spf entry:

v = spf1 a mx include: mailgun.org include: mydomain.com ~ all

+7
php schema gmail spf
source share
2 answers

Since you are sending an email using smtp google, you must include it in your SPF:

 include:_spf.google.com 
0
source share

You are sending from your host to Google via SMTP. This means that Google will see that your host is in your SPF record and is acting accordingly.

So, you must include your public ip in the SPF record and pray that this is enough.

Also, your username is myemail not myemail@gmail.com . And the password should be a real password, of course.

If nothing works, consult the PHPMailer logs, there should be more hints.

0
source share

All Articles