0
이것은 내 첫 번째 게시물입니다. 네!php mail() 함수를 사용하여 스팸 함을 피하는 방법
문의 양식에 문제가 있습니다. 그것은 내 스팸 함으로 이메일을 보냅니다.
php mail() 함수를 사용하여 스팸 함을 피하는 방법은 무엇입니까?
이미 유래와 저기 serverfault 검색하지만 난이 올바른 해결책을 찾을 수없는 것은 ....
이 내가 사용하고있는 코드입니다.
<?php
if (isset($_POST['email'])
&& isset($_POST['name'])
&& isset($_POST['message'])
) {
$admin_email = "[email protected]";
$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);
}
?>
미리 감사드립니다.
Google을 사용하셨습니까? 이것에 관한 게시물이 많이 있습니다. 편집 : 당신이 않았다을 추측한다. 글쎄, 당신은 충분히 멀리 보지 않았다. –