如何使用php mail()函数避免垃圾邮件
这是我的第一篇文章。是啊 我的联系方式有问题。它将电子邮件发送到我的spambox 如何使用php mail()函数避免spambox 我已经搜索了stackoverflow和serverfault,但似乎找不到正确的解决方案 这是我正在使用的代码如何使用php mail()函数避免垃圾邮件,php,html,email,spam,email-spam,Php,Html,Email,Spam,Email Spam,这是我的第一篇文章。是啊 我的联系方式有问题。它将电子邮件发送到我的spambox 如何使用php mail()函数避免spambox 我已经搜索了stackoverflow和serverfault,但似乎找不到正确的解决方案 这是我正在使用的代码 <?php if (isset($_POST['email']) && isset($_POST['name']) && isset($_POST['message']) ) { $admin_email =
<?php
if (isset($_POST['email'])
&& isset($_POST['name'])
&& isset($_POST['message'])
) {
$admin_email = "info@mywebsite.nl";
$name = htmlspecialchars($_POST['name']);
$phone = htmlspecialchars($_POST['phone']);
$email = htmlspecialchars($_POST['email']);
$subject = "Contact";
$comment = nl2br(htmlspecialchars($_POST['message']));
$to = $admin_email;
$headers = "From: " . $email . "\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$headers .= "Return-Path: The Sender <" . $admin_email . ">\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$message .= "<html>
<body style='margin: 0; padding: 0; font-family: Roboto Slab;'>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td>
<table style='border: 1px solid #c7c5c5;' align='center' cellpadding='0' cellspacing='0' width='600' style='border-collapse: collapse;'>
<tr height='301'>
<td align='center' bgcolor='#ffffff' style='padding: 0 0 0 0;'>
<img src='myimage' alt='Contact' width='100%' height='100%' style='display: block;' />
</td>
</tr>
<tr>
<td bgcolor='#eee' style='padding: 40px 30px 40px 30px; background-color: #eee;'>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td>
<h1 style='font-family: Roboto Slab;'>Contactinformation</h1>
</td>
</tr>
<tr>
<td style='padding: 20px 0 30px 0; font-family: Roboto Slab;'>
<b>From:</b> " . $naam . " <br/>
<b>E-mail:</b> " . $email . " <br/>
<b>Phone:</b> " . $phone . "
</td>
</tr>
<tr>
<td>
<h1 style='font-family: Roboto Slab;'>Message</h1>
</td>
</tr>
<tr>
<td style='padding: 20px 0 30px 0; font-family: Roboto Slab;'>
" . $comment . "
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor='#33333' style='padding: 30px 30px 30px 30px; background-color: #333;'>
<table cellpadding='0' cellspacing='0' width='100%'>
<td style='color: #fed136; font-family: Roboto Slab;' width='70%'>
Copyright ®
<a style='color: #fed136; font-family: Roboto Slab;' href=''></a> " . $thisyear . "<br/>
</td>
<td align='right'>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td>
<a style='color: #fed136; font-family: Roboto Slab;' href=''>
</a>
</td>
</tr>
</table>
</td>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>";
mail($to, $subject, $message, $headers);
}
?>
一些邮件客户端,如gmail有特定的规则将邮件标记为垃圾邮件。如果邮件主题或正文包含免费/promo/offer/等内容,并且不是来自受信任的发件人,则会将其标记为垃圾邮件。此外,此类邮件客户端还将一些发件人列入黑名单,并将其列在垃圾邮件框中。
很多大公司也有这种情况。你用谷歌搜索过吗?关于这一点,有很多帖子。编辑:我想是的。嗯,你看得不够远。