我的页面上有一个表格。当用户点击“发送”按钮时 - 它应该发送一封电子邮件,其中包含他在表单中输入的详细信息。直到最近,该表单都托管在 Linux 服务器上,我对它没有任何问题 - 邮件已发送和接收。最近我不得不转移到共享 Windows 服务器,自从转移以来,邮件没有发送。这是应该发送邮件的代码:
function send_contact_form($strName, $strEmail, $strPhone, $strMessage)
{
$to = '[email protected]';
$subject = 'From the site';
$message = '<html lang="HE">
<head>
<title>
'.$subject.'
</title>
</head>
<body style="text-align:right; direction:rtl; font-family: Arial;">
Name: '.$strName.'<br>Email: '
.$strEmail.'<br>Phone: '.$strPhone
.'<br><br>Message: <br>'.$strMessage.'
</body>
</html>';
$email = $strEmail;
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$header .= "From: $email\r\nReply-To: $email" . "\r\n";
mail($to, $subject, $message, $header);
}
在 Windows 环境中 PHP 使用 SMTP 代替 Linux 二进制 sendmail(或替换)
您需要根据以下内容编辑 php.ini这一页能够通过 mail() 函数发送电子邮件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)