消息主体中的链接时,从PHP发送邮件



我有一个php脚本

<?php
$to = 'somebody@somedomain.com';
$subject = 'Test mail';
$message = 'mysitedomain.com';
$from = 'support@mysitedomain.com';
$headers = 'From:' . $from;
mail($to,$subject,$message,$headers);
echo 'Mail Sent.';
?>

运行此代码邮件时未发送。如果我将消息更改给mySitedomainomcom(com之前没有点),邮件发送了sucdfull。

任何人都有解决方案?

该代码告诉邮件和收件人,该电子邮件包含良好的HTML,需要解释

如果您愿意,可以更改$消息的内容,现在使用此代码可以发送HTML内容邮件。

<?PHP
    $to = 'somebody@somedomain.com';
    $subject = 'Test mail';
    $headers =  "From: Support <support@mysitedomain.com>" . "rn";
    $headers .= "MIME-Version: 1.0rn";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1rn";
    $message = '<html><body>';
    $message .= '<h1>mysitedomain.com</h1>';
    $message .= '</body></html>';
    mail($to, $subject, $message, $headers);
?>

最新更新