我想用下面的模板发送php邮件是我的代码
<?php
// sending email
$SendFrom = "MyWebsite <no-reply@mywebsite.com>";
$SendTo = "$user_email";
$SubjectLine = "Welcome Email Activation";
// Build Message Body from Web Form Input
$MsgBody='Hello, <br/> <br/> Your are most welcome to Mywebsite.com<br/> <br/> Before you continue kindly activate your email by clicking on the below link or copy and paste it in your browser and hit enter for your email activation to take place.<br/> <br/> <a href="'.$base_url.'activation/index.php?code='.$activation.'">'.$base_url.'activation/index.php?code='.$activation.'</a>';
$MsgBody = htmlspecialchars($MsgBody); //make content safe
// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: " . $SendFrom);
?>
请注意,我使用简单的PHP代码而不是PDO,因为它对我有用 谢谢,任何帮助将不胜感激。
答案 0 :(得分:1)
要显示html电子邮件,您需要在标题Content-type: text/html; charset=utf-8
$headers = "From: no-reply@mywebsite.com" . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($SendTo, $SubjectLine, $MsgBody, $headers);
mail()
函数非常痛苦,还有其他更好的选项,例如MSDN Window Station and Desktop Functions reference或PHPMailer这些库很容易使用,而且您不需要配置标题废话。< / p>
答案 1 :(得分:0)
$./configure
$ make