Guest User

Untitled

a guest
Feb 20th, 2018
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. public function Sendmail1()
  2. {
  3. ini_set("display_errors", "1");
  4. error_reporting(E_ALL);
  5.  
  6. // event params
  7. $summary = 'Summary of the event';
  8. $venue = 'Kochi';
  9. $start = '20140820';
  10. $start_time = '160630';
  11. $end = '20140820';
  12. $end_time = '180630';
  13.  
  14. //PHPMailer
  15. $mail = new PHPMailer();
  16. $mail->IsSMTP();
  17. $mail->SMTPDebug = 0;
  18. $mail->SMTPAuth = TRUE;
  19. $mail->SMTPSecure = "ssl";
  20. $mail->Port = 465;
  21. $mail->Username = "test@gmail.com";
  22. $mail->Password = "test";
  23. $mail->Host = "smtp.gmail.com";
  24. $mail->Mailer = "smtp";
  25. $mail->SetFrom("test@office.com", "test");
  26. $mail->AddReplyTo("test@office.com", "test");
  27. $mail->addAddress('user1@office.com','user');
  28. $mail->ContentType = 'text/calendar';
  29.  
  30. $mail->Subject = "Outlooked Event";
  31. $mail->addCustomHeader('MIME-version',"1.0");
  32. $mail->addCustomHeader('Content-type',"text/calendar; method=REQUEST; charset=UTF-8");
  33. $mail->addCustomHeader('Content-Transfer-Encoding',"8bit");
  34. $mail->addCustomHeader('X-Mailer',"Microsoft Office Outlook 12.0");
  35. $mail->addCustomHeader("Content-class: urn:content-classes:calendarmessage");
  36. $event_id = 1234;
  37. $sequence = 0;
  38. $status = 'TENTATIVE';
  39. $ical = "BEGIN:VCALENDARrn";
  40. $ical .= "VERSION:2.0rn";
  41. $ical .= "PRODID:-//YourCassavaLtd//EateriesDept//ENrn";
  42. $ical .= "METHOD:REQUESTrn";
  43. $ical .= "BEGIN:VEVENTrn";
  44. $ical .= "ORGANIZER;SENT-BY="MAILTO:organizer@kaserver.com":MAILTO:onbehalfoforganizer@kaserver.comrn";
  45. $ical .= "ATTENDEE;CN=them@kaserver.com;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto:organizer@kaserver.comrn";
  46. $ical .= "UID:".strtoupper(md5($event_id))."-kaserver.comrn";
  47. $ical .= "SEQUENCE:".$sequence."rn";
  48. $ical .= "STATUS:".$status."rn";
  49. $ical .= "DTSTAMPTZID=Africa/Nairobi:".date('Ymd').'T'.date('His')."rn";
  50. $ical .= "DTSTART:".$start."T".$start_time."rn";
  51. $ical .= "DTEND:".$end."T".$end_time."rn";
  52. $ical .= "LOCATION:".$venue."rn";
  53. $ical .= "SUMMARY:".$summary."rn";
  54. //$ical .= "DESCRIPTION:".$event['description']."rn";
  55. $ical .= "BEGIN:VALARMrn";
  56. $ical .= "TRIGGER:-PT15Mrn";
  57. $ical .= "ACTION:DISPLAYrn";
  58. $ical .= "DESCRIPTION:Reminderrn";
  59. $ical .= "END:VALARMrn";
  60. $ical .= "END:VEVENTrn";
  61. $ical .= "END:VCALENDARrn";
  62.  
  63. $mail->Body = $ical;
  64.  
  65. //send the message, check for errors
  66. if(!$mail->send()) {
  67. $this->error = "Mailer Error: " . $mail->ErrorInfo;
  68. echo 'okie';
  69. } else {
  70. $this->error = "Message sent!";
  71. echo 'not okie';
  72. }
  73. }
  74.  
  75. Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
  76.  
  77. Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
  78.  
  79. Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
  80.  
  81. Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
  82.  
  83. for($index = 0; $index < count($this->CustomHeader); $index++) {
  84. $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
  85.  
  86. }
  87.  
  88. BEGIN:VCALENDAR
  89. VERSION:2.0
  90. PRODID:-//YourCassavaLtd//EateriesDept//EN
  91. METHOD:REQUEST
  92. BEGIN:VEVENT
  93. ORGANIZER;SENT-BY="MAILTO:organizer@kaserver.com":MAILTO:onbehalfoforganizer@kaserver.com
  94. ATTENDEE;CN=them@kaserver.com;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto:organizer@kaserver.com
  95. UID:81DC9BDB52D04DC20036DBD8313ED055-kaserver.com
  96. SEQUENCE:0
  97. STATUS:TENTATIVE
  98. DTSTAMPTZID=Africa/Nairobi:20180221T102303
  99. DTSTART:20140820T160630
  100. DTEND:20140820T180630
  101. LOCATION:Kochi
  102. SUMMARY:Summary of the event
  103. BEGIN:VALARM
  104. TRIGGER:-PT15M
  105. ACTION:DISPLAY
  106. DESCRIPTION:Reminder
  107. END:VALARM
  108. END:VEVENT
  109. END:VCALENDAR
Add Comment
Please, Sign In to add comment