【发布时间】:2018-02-26 20:21:07
【问题描述】:
我试图通过 php 编码来发送邮件。但它显示错误“SMTP 错误,550 Sender is not allowed”,是服务器问题还是编码有问题?
但是当我直接通过我的 cpanel 发送邮件时,它会被送达。
我用来发送邮件的代码是:
<?php
$to = "example@gmail.com";
$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: support@example.in' . "\r\n";
$headers .= 'Cc: uraijada@example.in' . "\r\n";
mail($to,$subject,$message,$headers);
?>
【问题讨论】:
-
您的邮件服务器可能将自己标识为
foo.example.com,而收件人的服务器正在“我非常怀疑是否允许 foo.example.com 使用 example.in 地址发送邮件”。跨度> -
如果不了解更多有关服务器配置的信息,可能无法回答此问题。