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 有没有整苹果智能分拣线上图像数据
  • ¥20 有没有人会这个东西的
  • ¥15 cfx考虑调整“enforce system memory limit”参数的设置
  • ¥30 航迹分离,航迹增强,误差分析
  • ¥15 Chrome Manifest扩展引用Ajax-hook库拦截请求失败
  • ¥15 用Ros中的Topic通讯方式控制小乌龟的速度,走矩形;编写订阅器代码
  • ¥15 LLM accuracy检测
  • ¥15 pycharm添加远程解释器报错
  • ¥15 如何让子窗口鼠标滚动独立,不要传递消息给主窗口