发送.ICS事件作为Laravel 4.1中的电子邮件附件



我正在尝试使用Laravel的MAIL类发送.ICS文件作为电子邮件附件。收到电子邮件时,Gmail不会要求我将事件添加到日历中。但是,我可以通过上传接收到的文件来轻松地将事件添加到日历中。(格式是有效的。)并且还有一个小日历图标,但根本没有花哨的格式或任何格式。这是我正在使用的代码:

$filename = "invite.ics";
$data[0]  = "BEGIN:VCALENDAR";
$data[1] = "PRODID:-//Google Inc//Google Calendar 70.9054//EN";
$data[2] = "VERSION:2.0";
$data[3] = "CALSCALE:GREGORIAN";
$data[4] = "METHOD:REQUEST";
$data[8] = "BEGIN:VEVENT";
$data[9] = "DTSTART:20140312T080000Z";
$data[10] = "DTEND:20140312T103000Z";
$data[11] = "DTSTAMP:20140312T072230Z";
$data[12] = "UID:aj5nufn03q772ukb54u1pp6c88@example.com";
$data[13] = "CREATED:20140312T072126Z";
$data[14] = "DESCRIPTION:Hair cut, 2,5h, 300Eur";
$data[15] = "LAST-MODIFIED:20140312T072206Z";
$data[16] = "LOCATION:";
$data[17] = "SEQUENCE:0";
$data[18] = "STATUS:CONFIRMED";
$data[19] = "SUMMARY:Matu griešana";
$data[20] = "TRANSP:OPAQUE";
$data[21] = "END:VEVENT";
$data[22] = "END:VCALENDAR";

$data = implode("rn", $data);
header("text/calendar");
file_put_contents($filename, "xEFxBBxBF".  $data);
Mail::send('emails.temp', array(), function($message) use($filename)
{
    $message->from('jon@example', 'Jon Doe');
    $message->to('osvalds.neiders@gmail.com')->subject('Registration information');
    $message->attach($filename, array('mime' => "text/calendar"));
});

在目标上创建文件并将其安装

name ="invite.ics"
matter= 
"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:aaaa@aaaa.com
DTSTART:20150315T170000Z
DTEND:20150315T180000Z
LOCATION:La Taska
TRANSP:OPAQUE
SEQUENCE:0
UID:d41d8cd98f00b204e9800998ecf8427e
DTSTAMP:20150313T150000Z
DESCRIPTION:The Programn Description
SUMMARY:The Programn Description
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR"

相关内容

  • 没有找到相关文章

最新更新