阅读outlook预约回复PHP

时间:2011-06-15 14:09:21

标签: php outlook calendar

我有一个页面,管理员为委员会创建活动,日历通知发送给给定委员会的所有成员。

我希望能够以某种方式检索回复,无论是被接受,暂定还是被拒绝,并显示回复列表以及事件信息。

活动创建者将被设置为使用电子邮件地址,其唯一目的是创建活动。

我能够连接到收件箱并阅读电子邮件,我可以很好地阅读初始事件创建,就像它的ics文件一样,但是当我尝试从某人那里读取响应时,我得到的就是垃圾:

--_000_D3E7EC0B6389944E84089DB2A556B79F01214822CACALOIS_ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 SnVzdCBpbiBjYXNlIHlvdSBuZWVkIHRvIHNlZSBhIHJlc3BvbnNlLg0KDQo --_000_D3E7EC0B6389944E84089DB2A556B79F01214822CACALOIS_ Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: base64 PGh0bWw+DQo8aGVhZD4NCjxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0i dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ij4NCjxtZXRhIG5hbWU9IkdlbmVyYXRvciIgY29udGVu dD0iTWljcm9zb2Z0IEV4Y2hhbmdlIFNlcnZlciI+DQo8IS0tIGNvbnZlcnRlZCBmcm9tIHJ0ZiAt LT4NCjxzdHlsZT48IS0tIC5FbWFpbFF1b3RlIHsgbWFyZ2luLWxlZnQ6IDFwdDsgcGFkZGluZy1s ZWZ0OiA0cHQ7IGJvcmRlci1sZWZ0OiAjODAwMDAwIDJweCBzb2xpZDsgfSAtLT48L3N0eWxlPg0K PC9oZWFkPg0KPGJvZHk+DQo8Zm9udCBmYWNlPSJDYWxpYnJpLCBzYW5zLXNlcmlmIiBzaXplPSIy Ij4NCjxkaXY+SnVzdCBpbiBjYXNlIHlvdSBuZWVkIHRvIHNlZSBhIHJlc3BvbnNlLjwvZGl2Pg0K PGRpdj4mbmJzcDs8L2Rpdj4NCjwvZm9udD4NCjwvYm9keT4NCjwvaHRtbD4NCg== --_000_D3E7EC0B6389944E84089DB2A556B79F01214822CACALOIS_ Content-Type: text/calendar; charset="utf-8"; method=REPLY Content-Transfer-Encoding: base64 QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVQTFkNClBST0RJRDpNaWNyb3NvZnQgRXhjaGFuZ2Ug U2VydmVyIDIwMDcNClZFUlNJT046Mi4wDQpCRUdJTjpWVElNRVpPTkUNClRaSUQ6Q2VudHJhbCBT dGFuZGFyZCBUaW1lDQpCRUdJTjpTVEFOREFSRA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDANClRa T0ZGU0VURlJPTTotMDUwMA0KVFpPRkZTRVRUTzotMDYwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7SU5U RVJWQUw9MTtCWURBWT0xU1U7QllNT05USD0xMQ0KRU5EOlNUQU5EQVJEDQpCRUdJTjpEQVlMSUdI VA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDANClRaT0ZGU0VURlJPTTotMDYwMA0KVFpPRkZTRVRU TzotMDUwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7SU5URVJWQUw9MTtCWURBWT0yU1U7QllNT05USD0z DQpFTkQ6REFZTElHSFQNCkVORDpWVElNRVpPTkUNCkJFR0lOOlZFVkVOVA0KT1JHQU5JWkVSO0NO PVJ5YW4gTGVpc2luZzpNQUlMVE86cmxlaXNpbmdAbWl0Y2hlbGx3YXluZS5jb20NCkFUVEVOREVF O1BBUlRTVEFUPUFDQ0VQVEVEO0NOPUtlbGxpIEdldHRpbmdlcjpNQUlMVE86a2VsbGlAbWl0Y2hl bGx3YXluZS5jbw0KIG0NCkNPTU1FTlQ7TEFOR1VBR0U9ZW4tVVM6SnVzdCBpbiBjYXNlIHlvdSBu ZWVkIHRvIHNlZSBhIHJlc3BvbnNlLlxuXG4NClNVTU1BUlk7TEFOR1VBR0U9ZW4tVVM6QWNjZXB0 ZWQ6IHRlc3RpbmcNCkRUU1RBUlQ7VFpJRD1DZW50cmFsIFN0YW5kYXJkIFRpbWU6MjAxMTA2MTVU MTUzMDAwDQpEVEVORDtUWklEPUNlbnRyYWwgU3RhbmRhcmQgVGltZToyMDExMDYxNVQxNjAwMDAN ClVJRDowNDAwMDAwMDgyMDBFMDAwNzRDNUI3MTAxQTgyRTAwODAwMDAwMDAwMjBFNkFFN0Y2RDJC Q0MwMTAwMDAwMDAwMDAwMDAwMA0KIDAxMDAwMDAwMDBCRDdCRDdDNDlDMjIyNDg4QTZFMTE3OTc4 QzdDNUQyDQpDTEFTUzpQVUJMSUMNClBSSU9SSVRZOjUNCkRUU1RBTVA6MjAxMTA2MTVUMjAwNDM3 Wg0KVFJBTlNQOk9QQVFVRQ0KU1RBVFVTOkNPTkZJUk1FRA0KU0VRVUVOQ0U6MA0KTE9DQVRJT047 TEFOR1VBR0U9ZW4tVVM6TVdUDQpYLU1JQ1JPU09GVC1DRE8tQVBQVC1TRVFVRU5DRTowDQpYLU1J Q1JPU09GVC1DRE8tT1dORVJBUFBUSUQ6LTExOTAxNzI3MDkNClgtTUlDUk9TT0ZULUNETy1CVVNZ U1RBVFVTOkJVU1kNClgtTUlDUk9TT0ZULUNETy1JTlRFTkRFRFNUQVRVUzpCVVNZDQpYLU1JQ1JP U09GVC1DRE8tQUxMREFZRVZFTlQ6RkFMU0UNClgtTUlDUk9TT0ZULUNETy1JTVBPUlRBTkNFOjEN ClgtTUlDUk9TT0ZULUNETy1JTlNUVFlQRTowDQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVOREFSDQo --_000_D3E7EC0B6389944E84089DB2A556B79F01214822CACALOIS_--

以下是我创建和发送通知的方式。

$vcal = "BEGIN:VCALENDAR\r\n";
$vcal .= "PRODID:-//CompanyName//ProductName//EN\r\n";
$vcal .= "VERSION:2.0\r\n";
$vcal .= "METHOD:REQUEST\r\n";
$vcal .= "BEGIN:VEVENT\r\n";
foreach($comstmt->fetchAll(PDO::FETCH_ASSOC) as $commem){
    $vcal .= "ATTENDEE;CN=\"".$commem['first']." ".$commem['last']."\";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:".$commem['email']."\r\n";
}
$vcal .= "ATTENDEE;CN=\"Ryan Leising\";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:rleising@mitchellwayne.com\r\n";
$vcal .= "DESCRIPTION:".$_POST['event_description']."\r\n";
$vcal .= "DTEND:$dtend\r\n"; 
$vcal .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";
$vcal .= "DTSTART:$dtstart\r\n";
$vcal .= "LOCATION:".$_POST['event_location']."\r\n";
$vcal .= "SUMMARY:".$comname." event\r\n";
$vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-domain.com\r\n";
$vcal .= "BEGIN:VALARM\r\n";
$vcal .= "TRIGGER:-PT15M\r\n";
$vcal .= "ACTION:DISPLAY\r\n";
$vcal .= "END:VALARM\r\n";
$vcal .= "END:VEVENT\r\n";
$vcal .= "END:VCALENDAR\r\n";
$headers = "From: rleising@mitchellwayne.com\r\nReply-To: rleising@mitchellwayne.com"; 
$headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; method=REQUEST; charset=\"iso-8859-1\"";
$headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0"; 
$mailsent = mail($to, $comname." event", $vcal, $headers);

1 个答案:

答案 0 :(得分:1)

PHP IMAP开始,选中新邮件框并整理您要解析的邮件。除此之外,您还需要确定Outlook回复消息的结构,并开始解析所需的信息。 preg_match()将是您的朋友,可以在那里提取文字,但如果没有看到这些消息的示例,我们将无法提供更多帮助。

mailparse库有助于解析MIME邮件,只要在imap_fetchbody()不够的情况下检索邮件正文即可。