ds78662302 2018-08-10 04:14
浏览 57

使用PHP发送电子邮件通知[重复]

This question already has an answer here:

I have a problem for make email notification when I create account in my website and then give a notification to user via email. This is an error statement :

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Helpdesk\traxteam\mail.php on line 8

This is mail.php

<?php 
$b = 0; 
$mail_attached = ""; 
$boundary = md5(time()); 


$add_header = "MIME-Version: 1.0
". 
"Content-Type: multipart/mixed; boundary="$boundary"; Message-ID: <".md5($email_from).">"; 
$mail_content = "--".$boundary."
". 
"Content-Type: text/plain; charset="UTF-8"
". 
"Content-Transfer-Encoding: 8bit 

". 
$msg." nn". 
$mail_attached; 
mail($email_address, $subject, $mail_content, "From: ".$email_from."
CC: ".$email_cc."

BCC: ".$email_bcc ."
 Errors-To: ".$email_from."
".$add_header); 
?>

and this my 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!");
} 

?>
</div>
  • 写回答

1条回答 默认 最新

  • dongtuo1482 2018-08-10 04:29
    关注

    change the line number 8

    "Content-Type: multipart/mixed; boundary="$boundary"; Message-ID: <".md5($email_from).">"; 
    

    should be

    "Content-Type: multipart/mixed; boundary=\"$boundary\"; Message-ID: <".md5($email_from).">"; 
    

    and

    "Content-Type: text/plain; charset="UTF-8"
    ".
    

    should be

    "Content-Type: text/plain; charset=\"UTF-8\"
    ".
    
    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计