通过邮件发送日历请求 [英] sending calendar request through mail

查看:488
本文介绍了通过邮件发送日历请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过我的PHP代码实现日历请求邮件。我的代码如下:

I am trying to implement the calendar request mail through my php code. My code is like :

$to = "srimanta.chakraborty@fugenx.com";
$subject = "Training Registration";
$message = "Thank you for participating in the Technical Certification training program.";
$location = "Conf";
//==================
$headers = "Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;";
$headers .= "Content-Type: text/plain;charset=utf-8";
$messaje = "BEGIN:VCALENDAR";
$messaje .= "VERSION:2.0";
$messaje .= "PRODID:PHP";
$messaje .= "METHOD:REQUEST";
$messaje .= "BEGIN:VEVENT";
$messaje .= "DTSTART:20121223T171010Z";
$messaje .= "DTEND:20121223T191010Z";
$messaje . "DESCRIPTION: You have registered for the class";
$messaje .= "SUMMARY:Technical Training";
$messaje .= "ORGANIZER; CN=\"Corporate\":mailto:jayashree.g@fugenx.com";
$messaje .= "Location:" . $location . "";
$messaje .= "UID:040000008200E00074C5B7101A82E00800000006FC30E6 C39DC004CA782E0C002E01A81\n";
$messaje .= "SEQUENCE:0\n";
$messaje .= "DTSTAMP:".date('Ymd').'T'.date('His')."\n";
$messaje .= "END:VEVENT\n";
$messaje .= "END:VCALENDAR\n";
$headers .= $messaje;
mail($to, $subject, $message, $headers);

通过此代码我有邮件,但不是日历请求格式。此外,邮件已经转发,并附带了一个附件Training Registration.ics文件。
我需要接受,暂定,拒绝,建议新时间,日历选项以及邮件。
请指导我如何做。
感谢。

By this code I got mail but not in terms of calendar request format. Also mail has been forwarded along with an attachment "Training Registration.ics" file. I need the Accept, Tentative, Decline, Propose New Time, Calendar option along with the mail. Please guide me how to do that. Thanks.

推荐答案

$headers = 'Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\n';

这里,尝试将单引号更改为双引号('=>)

Here, try to change single quote to double quote('=>")

这是因为dingle报价将转义\r和\\\


参考

It is because dingle quote will escape \r and \n
Reference

更新

最后,我在下面做了建议,改变你的标题,至少在我身边。

Update
Finally, I do the suggestion in below and change your header and, at least, it work on my side.

$to = "srimanta.chakraborty@fugenx.com";
$subject = "Training Registration";
$message = "Thank you for participating in the Technical Certification training program.\r\n\r\n";
$location = "Conf";
//==================
$headers .= "MIME-version: 1.0\r\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\r\n";
$headers .= "Content-type: text/calendar; method=REQUEST; charset=UTF-8\r\n";
$messaje = "BEGIN:VCALENDAR\r\n";
$messaje .= "VERSION:2.0\r\n";
$messaje .= "PRODID:PHP\r\n";
$messaje .= "METHOD:REQUEST\r\n";
$messaje .= "BEGIN:VEVENT\r\n";
$messaje .= "DTSTART:20121223T171010Z\r\n";
$messaje .= "DTEND:20121223T191010Z\r\n";
$messaje .= "DESCRIPTION: You have registered for the class\r\n";
$messaje .= "SUMMARY:Technical Training\r\n";
$messaje .= "ORGANIZER; CN=\"Corporate\":mailto:jayashree.g@fugenx.com\r\n";
$messaje .= "Location:" . $location . "\r\n";
$messaje .= "UID:040000008200E00074C5B7101A82E00800000006FC30E6 C39DC004CA782E0C002E01A81\r\n";
$messaje .= "SEQUENCE:0\r\n";
$messaje .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";
$messaje .= "END:VEVENT\r\n";
$messaje .= "END:VCALENDAR\r\n";
$message .= $messaje;
mail($to, $subject, $message, $headers);

这篇关于通过邮件发送日历请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆