这是我用来发送邮件但是邮件没有发送到gmail和yahoo邮件ID的示例代码。 但是当我在我的服务器上发送邮件时,它会发送。代码或服务器问题是否有任何问题。
<?php
$to = 'myemail@myserver.com';
// Subject
$subject = 'Birthday Reminders';
// Message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Johny</td><td>10th</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
$headers .= 'MIME-Version: 1.0';
$headers .= 'Content-type: text/html; charset=UTF-8';
$headers .= 'From: Birthday Reminder <birthday@example.com>';
mail($to,$subject,$message,$headers);
?>