我正在创建一个注册表单,当您提交它时会向您发送一封确认电子邮件。我希望我的电子邮件不仅仅是文本。
我不知道如何执行此操作或从哪里开始我试图搜索这个,我没有正确的关键字,因为什么都没有出现。我尝试添加 html 标签和样式,但它只是作为原始文本出现。
帮助?
$to = 'user@gmail.com';
$subject = '2014 Comfirmation';
$message = "<h1>Test Header<h1>\r\n
<img src=\"http://www.image.com/_newSite/img/logo.jpg\"/>
<p style='border:solid thin red'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc malesuada dui a dictum blandit. Suspendisse commodo tincidunt diam. Duis orci tellus, imperdiet et vestibulum vitae, aliquet sit amet velit. Aenean a massa eu neque interdum viverra. Donec interdum arcu neque, ac egestas lectus mattis a. Duis nec dictum mauris. In eget facilisis nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Aenean ac leo ut mauris aliquet gravida eget eu magna. Mauris ullamcorper sagittis risus, eu molestie mi iaculis eu. Proin ut elementum risus. Vivamus rhoncus ipsum elit, in ultrices quam elementum et.</p>
Line 2\r\n
Line 3
";
$headers = 'From: from@gmail.com' . "\r\n" .
'Reply-To: from@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
// Send
@mail($to, $subject, $message, $headers);