Advertisement
Guest User

Untitled

a guest
Jul 14th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. public function createScheduleNotification(){
  2.  
  3. $from = 'info@careervita.com';
  4. $fromName = 'info';
  5. $to = 'testcareervita@outlook.com';
  6. $subject = 'Invitation for Test Demo';
  7. $desc = 'THIS IS TEST DEMO INVITAION';
  8. $uid = date('Ymd').'T'.date('His')."-".rand();
  9.  
  10. $message = "BEGIN:VCALENDARrn";
  11. $message.= "PRODID:-//Zoho CRM//NONSGML Calendar//ENrn";
  12. $message.= "VERSION:2.0rn";
  13. $message.= "X-WR-TIMEZONE:GMTrn";
  14. $message.= "X-WR-CALNAME:ZCRMrn";
  15. $message.= "METHOD:REQUESTrn";
  16. $message.= "CALSCALE:GREGORIANrn";
  17. $message.= "BEGIN:VEVENTrn";
  18. $message.= "UID:".$uid."rn";
  19. $message.= "DESCRIPTION:".$desc."rn";
  20. $message.= "ORGANIZER;CN= Manisha:mailto:manisha.g@careervita.comrn";
  21. $message.= "DTSTART:20150710T100010Zrn";
  22. $message.= "DTEND:20150710T110000Zrn";
  23. $message.= "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Vinod T:mailto:g_manisha@outlook.comrn";
  24. $message.= "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Vivek J:mailto:manisha.gaidhane8788@gmail.comrn";
  25. $message.= "LOCATION:CV360rn";
  26. $message.= "CREATED:20150701T060720Zrn";
  27. $message.= "LAST-MODIFIED:20150701T060720Zrn";
  28. $message.= "X-EVENT-OWNER:1563791000000084003rn";
  29. $message.= "END:VEVENTrn";
  30. $message.= "END:VCALENDAR";
  31.  
  32. Yii::import('application.extensions.phpmailer.JPhpMailer');
  33. $mailer = new JPhpMailer(true);
  34. if (Yum::module()->phpmailer['transport'])
  35. switch (Yum::module()->phpmailer['transport']){
  36. case 'smtp':
  37. $mailer->IsSMTP();
  38. break;
  39. case 'sendmail':
  40. $mailer->IsSendmail();
  41. break;
  42. case 'qmail':
  43. $mailer->IsQmail();
  44. break;
  45. case 'mail':
  46. default:
  47. $mailer->IsMail();
  48. }
  49. else
  50. $mailer->IsMail();
  51. $mailer->IsHTML(true);
  52.  
  53. $mailerconf=Yum::module()->phpmailer['properties'];
  54. if(is_array($mailerconf))
  55. foreach($mailerconf as $key=>$value) {
  56. if(isset(JPhpMailer::${$key}))
  57. JPhpMailer::${$key} = $value;
  58. else
  59. $mailer->$key=$value;
  60. }
  61.  
  62. $mailer->SetFrom($from);
  63. $mailer->AddAddress($to);
  64. $mailer->Subject = $subject;
  65. $mailer->Body = $message;
  66. $mailer->AltBody = $body;
  67. $mailer->AddCC('testcareervita@gmail.com', 'Person One');
  68. $mailer->AddCC('testcareervita@yahoo.in', 'Person Two');
  69.  
  70. $mailer->ContentType = 'text/calendar';
  71. $mailer->CharSet = 'UTF-8';
  72. $mailer->addCustomHeader("MIME-version : 1.0");
  73. $mailer->addCustomHeader('Content-type : text/calendar; name="testcal.ics"; method=REQUEST;');
  74. $mailer->addCustomHeader('Content-Transfer-Encoding:7bit'); //to interpret ics file
  75. $mailer->addCustomHeader("Content-class: urn:content-classes:calendarmessage");
  76. $mailer->addCustomHeader('Content-Disposition : inline; filename="testcal.ics"');
  77. return $mailer->Send();
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement