【发布时间】:2015-12-05 13:12:18
【问题描述】:
我正在使用这个基本的 php 代码发送一个 html 电子邮件。
当我使用email@email.com 作为解决脚本工作的地址时。
但是,当我尝试使用 email.2015@gmail.com 时,脚本会说:
Parse error: syntax error, unexpected '@' in /home/u925912002/public_html/send_email.php on line 3
我的代码:
<?php
$to = ‘email.2015@gmail.com’;
$subject = 'I need to show html';
$from ='example@example.com';
$body = '<p style=color:red;>This text should be red</p>';
ini_set("sendmail_from", $from);
$headers = "From: " . $from . "\r\nReply-To: " . $from . "";
$headers .= "Content-type: text/html\r\n";
if (mail($to, $subject, $body, $headers)) {
echo("<p>Sent</p>");
} else {
echo("<p>Error...</p>");
}
?>
请有人告诉我我做错了什么。谢谢
【问题讨论】:
-
为什么您在电子邮件中的引号看起来不一样?