当前位置:Gxlcms > PHP教程 > PHP发送outlook约会邮件

PHP发送outlook约会邮件

时间:2021-07-01 10:21:17 帮助过:4人阅读

  1. <?php
  2. $to = "other@xxxx.net";
  3. $from = "me@xxxx.net";
  4. $subj = "my test subject";
  5. $msg = "this is the email body";
  6. $header = "From: " . $from . "\r\n" .
  7. "MIME-Version: 1.0\r\n" .
  8. "Content-Type: text/calendar;method=REQUEST";
  9. $txt_msg = "this is my text message, to be attached\r\n" .
  10. "not much to it, eh.";
  11. //Various ways to creat a new, random UID
  12. $cal_uid = "{" . uniqid(mt_rand(), true) . "}";
  13. $cal_uid = "{" . date('Ymd').'T'.date('His')."-".rand()."@mydomain.com}";
  14. $cal_uid = com_create_guid();
  15. $cal_msg =
  16. "BEGIN:VCALENDAR
  17. PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
  18. VERSION:2.0
  19. METHOD:REQUEST
  20. BEGIN:VEVENT
  21. ORGANIZER:MAILTO:name
  22. DTSTART:20090901T170000Z
  23. DTEND:20090901T035959Z
  24. UID:" . $cal_uid . "
  25. LOCATION:my meeting location
  26. TRANSP:OPAQUE
  27. SEQUENCE:0
  28. DTSTAMP:20060309T045649Z
  29. CATEGORIES:Meeting
  30. DESCRIPTION:meeting description, line 1 of 2.\nline 2 of 2.\n\n
  31. SUMMARY:meeting subject
  32. PRIORITY:5
  33. X-MICROSOFT-CDO-IMPORTANCE:1
  34. CLASS:PUBLIC
  35. BEGIN:VALARM
  36. TRIGGER:-PT3D
  37. ACTION:DISPLAY
  38. DESCRIPTION:Reminder
  39. END:VALARM
  40. BEGIN:VTIMEZONE
  41. TZID:US/Central
  42. END:VTIMEZONE
  43. END:VEVENT
  44. END:VCALENDAR";
  45. if (mail($to, $subj, $cal_msg, $header, "")) {
  46. echo "test email sent";
  47. } else {
  48. echo "test email failed";
  49. }
  50. ?>

人气教程排行