0

I want to send an email on my website via the PHP mail() function. I've setup postfix using this tutorial from digitalocean.com, and I can now send emails with the function to every email except those ending with @gmail.com.

This is my PHP code:

$mailtext = '
<html>
<head>
 <meta charset="utf-8">

 <title>Email Verification</title>
</head>
<body style="height: 100%; font-family: Arial, Helvetica, sans-serif;">
                    
 <p>...</p>

</body>
</html>
';

$to = $user['email'];
$subject = "subject";
$header  = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=utf-8\r\n";
$header .= "From: no-reply@example.org\r\n";
mail($to, $subject, $mailtext, $header);

I have searched for other answers on google, but have not found a solution yet.

EDIT: I've just checked my logs and found out that Google has seen my email as spam and therefore not allowed it to go through. How can I make google allow my mail?

TOdiDs
  • 26
  • 6
  • Depends on _why_ google rejected the message. "has seen as spam" certainly is _not_ the specific reason google named. – arkascha Jul 03 '23 at 17:00
  • Read the duplicate for lots of suggestions on making your mail more reliable – ADyson Jul 03 '23 at 17:07

0 Answers0