当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Sending event invites (ics) to hotmail users

问题描述:

I have a piece of code that looks like the code bellow. It creates a Swift Attachment and creates a Swift mail. As part of the mail I also included the content of the ics (I found some code that did that, but doesn't help).

The problem is that the ics is not recognized as an event in Hotmail. Only in the inbox summary line a event logo is added, but when the e-mail is opened it doesn't show the usual event invite overview.

 $attachment = \Swift_Attachment::fromPath($location, 'application/ics')->setFileName('invite.ics')->setDisposition('inline');

$contents = file_get_contents($location);

$message = \Swift_Message::newInstance()

->setSubject('Title')

->setFrom($this->fromMail)

->setTo($email)

->setBody($this->renderView('PastonVerBundle:Mail:invite.text.twig', $parameters))

->addPart($this->renderView('PastonVerBundle:Mail:invite.html.twig', $parameters), 'text/html')

->addPart($contents, 'text/calendar')

->attach($attachment)

;

Example of an ics

BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//PASTON-12//NONSGML kigkonsult.se iCalcreator 2.10.23//

X-WR-CALNAME:safsafasdf345541111

X-WR-CALDESC:asdfasdfasdf

X-WR-TIMEZONE:Africa/Johannesburg

BEGIN:VEVENT

UID:[email protected]

DTSTAMP:20120305T140831Z

DESCRIPTION:asdfasdfasdf

DTSTART:20120129T000000Z

DTEND:20120229T010000Z

LOCATION:

SUMMARY:safsafasdf345541111

END:VEVENT

END:VCALENDAR

分享给朋友:
您可能感兴趣的文章:
随机阅读: