我使用以下代码使用PHP代码在wordpress中发送邮件。当我使用info@xyz.com =
时,它对我来说很好,但是当我使用info@xyz.net
时,我无法发送邮件。但在前端我得到了成功的消息。请有人帮帮我吗?
$to = 'support@xyz.net';
$subject = $_POST["subject"];
$message = $_POST["message"] . "\n\n<br/>" . $_POST["name"];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: info@xyz.net' . "\r\n" .
'Reply-To: info@xyz.net' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
if(@mail($to, $subject, $message, $headers)){
echo "Your request was successfully sent. Thank you!";
}
else{
echo "Failed to send your request. Please try later!";
}