在网站上创建帐户并通过电子邮件向用户发送通知时,我无法发送电子邮件通知。这是一个错误声明:
解析错误:语法错误,第8行的C:\ xampp \ htdocs \ Helpdesk \ traxteam \ mail.php中出现意外的T_VARIABLE
这是mail.php
<?php
$b = 0;
$mail_attached = "";
$boundary = md5(time());
$add_header = "MIME-Version: 1.0\n".
"Content-Type: multipart/mixed; boundary="$boundary"; Message-ID: <".md5($email_from).">";
$mail_content = "--".$boundary."\n".
"Content-Type: text/plain; charset="UTF-8"\n".
"Content-Transfer-Encoding: 8bit \n\n".
$msg." nn".
$mail_attached;
mail($email_address, $subject, $mail_content, "From: ".$email_from."\nCC: ".$email_cc."\n
BCC: ".$email_bcc ."\n Errors-To: ".$email_from."\n".$add_header);
?>
这是我的create_proses.php
<?php
$From = "my.web@web.co.id";
$To = $email;
$Subject = "User Account for Trax helpdesk Website";
$Message = "Your account has been created. Your Password = Your ID.";
$Host = "192.168.180.15";
$Username = "";
$Password = "";
// Do not change bellow
$Headers = array ('From' => $From, 'To' => $To, 'Subject' => $Subject);
$SMTP = Mail::factory('smtp', array ('host' => $Host, 'auth' => true,
'username' => $Username, 'password' => $Password));
$mail = $SMTP->send($To, $Headers, $Message);
if (PEAR::isError($mail))
{
echo($mail->getMessage());
} else {
echo("Email Message sent!");
}
?>
答案 0 :(得分:0)
更改第8行
"Content-Type: multipart/mixed; boundary="$boundary"; Message-ID: <".md5($email_from).">";
应该是
"Content-Type: multipart/mixed; boundary=\"$boundary\"; Message-ID: <".md5($email_from).">";
和
"Content-Type: text/plain; charset="UTF-8"\n".
应该是
"Content-Type: text/plain; charset=\"UTF-8\"\n".