dongpo1846 2012-10-04 11:56
浏览 111
已采纳

icalendar和phpmailer.php

i am trying to send icalendar to the users, so that they can open these ics files in outlook and save the appointment. mailer i am using is 'phpmailer.php'.

problem is that it sends ical format as html in message body. Here is my code


$text="
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
CATEGORIES:MEETING
STATUS:TENTATIVE
DTSTART:".$startDateTime."
DTEND:".$endDateTime."
SUMMARY:Interview for the candidate".$cname."
DESCRIPTION:".$message."
CLASS:PRIVATE
END:VEVENT
END:VCALENDAR";

$mail->SetFrom('xxxxxx@yahoo.com', 'xxxx');
$mail->IsSMTP();
$mail->Host = "smtp.mail.yahoo.com";

$mail->SMTPAuth = true;
$mail->Username = 'xxxxxxxx@yahoo.com';
$mail->Password = 'xxxxx';


$mail->AddAddress($addresses[$i]);
$mail->Subject    = "Interview schedule of Candidate";

    $headers = "From: Sender
";
        $headers .= "Reply-To: xxxxxx@yahoo.com
";
        $headers .= "MIME-Version: 1.0
";
        $headers .= "Content-Type: text/calendar; method=REQUEST; charset=utf-8
";
        $headers .= "Content-Transfer-Encoding: 8bit
";
        $headers .= "Content-class: urn:content-classes:calendarmessage
";
$mail->Body=$body;

if(!$mail->Send($headers,$body)) 
{
        echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
    echo "Message sent!";
}


Please let me know what is wrong with my code. Thanks in advance

  • 写回答

3条回答 默认 最新

  • douxiongzhen2126 2012-10-25 16:39
    关注

    You could also have tried:

    $mail->IsHTML(FALSE);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料