http://webprojects.co/dev_wed/mail.php 이 스크립트를 사용하여 서버에서 메일을 보내려고 시도했지만 서버에서 메일을 보낼 수 없습니다.
<?php
$to = "[email protected]";
$subject = "HTML email";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$result = mail($to,$subject,$message,$headers);
if(!$result) {
echo "Error";
} else {
echo "Success";
}
?>
온라인 또는 로컬 호스트를 통해 코드를 테스트하고 있습니까? mail () 함수는 SMTP가없는 localhost에서 작동하지 않습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다