Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function Sendmail1()
- {
- ini_set("display_errors", "1");
- error_reporting(E_ALL);
- // event params
- $summary = 'Summary of the event';
- $venue = 'Kochi';
- $start = '20140820';
- $start_time = '160630';
- $end = '20140820';
- $end_time = '180630';
- //PHPMailer
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->SMTPDebug = 0;
- $mail->SMTPAuth = TRUE;
- $mail->SMTPSecure = "ssl";
- $mail->Port = 465;
- $mail->Username = "test@gmail.com";
- $mail->Password = "test";
- $mail->Host = "smtp.gmail.com";
- $mail->Mailer = "smtp";
- $mail->SetFrom("test@office.com", "test");
- $mail->AddReplyTo("test@office.com", "test");
- $mail->addAddress('user1@office.com','user');
- $mail->ContentType = 'text/calendar';
- $mail->Subject = "Outlooked Event";
- $mail->addCustomHeader('MIME-version',"1.0");
- $mail->addCustomHeader('Content-type',"text/calendar; method=REQUEST; charset=UTF-8");
- $mail->addCustomHeader('Content-Transfer-Encoding',"8bit");
- $mail->addCustomHeader('X-Mailer',"Microsoft Office Outlook 12.0");
- $mail->addCustomHeader("Content-class: urn:content-classes:calendarmessage");
- $event_id = 1234;
- $sequence = 0;
- $status = 'TENTATIVE';
- $ical = "BEGIN:VCALENDARrn";
- $ical .= "VERSION:2.0rn";
- $ical .= "PRODID:-//YourCassavaLtd//EateriesDept//ENrn";
- $ical .= "METHOD:REQUESTrn";
- $ical .= "BEGIN:VEVENTrn";
- $ical .= "ORGANIZER;SENT-BY="MAILTO:organizer@kaserver.com":MAILTO:onbehalfoforganizer@kaserver.comrn";
- $ical .= "ATTENDEE;CN=them@kaserver.com;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto:organizer@kaserver.comrn";
- $ical .= "UID:".strtoupper(md5($event_id))."-kaserver.comrn";
- $ical .= "SEQUENCE:".$sequence."rn";
- $ical .= "STATUS:".$status."rn";
- $ical .= "DTSTAMPTZID=Africa/Nairobi:".date('Ymd').'T'.date('His')."rn";
- $ical .= "DTSTART:".$start."T".$start_time."rn";
- $ical .= "DTEND:".$end."T".$end_time."rn";
- $ical .= "LOCATION:".$venue."rn";
- $ical .= "SUMMARY:".$summary."rn";
- //$ical .= "DESCRIPTION:".$event['description']."rn";
- $ical .= "BEGIN:VALARMrn";
- $ical .= "TRIGGER:-PT15Mrn";
- $ical .= "ACTION:DISPLAYrn";
- $ical .= "DESCRIPTION:Reminderrn";
- $ical .= "END:VALARMrn";
- $ical .= "END:VEVENTrn";
- $ical .= "END:VCALENDARrn";
- $mail->Body = $ical;
- //send the message, check for errors
- if(!$mail->send()) {
- $this->error = "Mailer Error: " . $mail->ErrorInfo;
- echo 'okie';
- } else {
- $this->error = "Message sent!";
- echo 'not okie';
- }
- }
- Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
- Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
- Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
- Notice: Undefined offset: 1 in /var/www/html/manage/libraries/phpMailer/class.phpmailer.php on line 1141
- for($index = 0; $index < count($this->CustomHeader); $index++) {
- $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
- }
- BEGIN:VCALENDAR
- VERSION:2.0
- PRODID:-//YourCassavaLtd//EateriesDept//EN
- METHOD:REQUEST
- BEGIN:VEVENT
- ORGANIZER;SENT-BY="MAILTO:organizer@kaserver.com":MAILTO:onbehalfoforganizer@kaserver.com
- ATTENDEE;CN=them@kaserver.com;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto:organizer@kaserver.com
- UID:81DC9BDB52D04DC20036DBD8313ED055-kaserver.com
- SEQUENCE:0
- STATUS:TENTATIVE
- DTSTAMPTZID=Africa/Nairobi:20180221T102303
- DTSTART:20140820T160630
- DTEND:20140820T180630
- LOCATION:Kochi
- SUMMARY:Summary of the event
- BEGIN:VALARM
- TRIGGER:-PT15M
- ACTION:DISPLAY
- DESCRIPTION:Reminder
- END:VALARM
- END:VEVENT
- END:VCALENDAR
Add Comment
Please, Sign In to add comment