Hi I just want to know how to mail an outlook event through laravel 5. Can anyone help me with this? Below is my code:
routes.php
Route::get('order/{order_id}/outlookevent', array('as' => 'order.outlookevent', 'uses' => 'OrderController@createOutlookEvent'));
My Controller page:
public function createOutlookEvent($order_id)
{
$order = Order::findOrFail($order_id);
$data['order_number'] = $order->order_number;
$data['to'] = 'test@hotmail.com';
$data['subject'] = "Millennium Falcon";
$data['organizer'] = 'sample';
$data['organizer_email'] = 'sample@gmail.com';
$data['participant_name_1'] = 'test';
$data['participant_email_1']= 'sample_test@yahoo.co.in';
$data['location'] = "Redmont-Seattle";
$data['date'] = '20150812';
$data['startTime'] = '0800';
$data['endTime'] = '0900';
$data['subject'] = 'Krankontrollen Estimation';
$data['desc'] = 'The purpose of the meeting is to discuss the capture of Krankontrollen Estimation and its crew.';
$data['headers'] = 'Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\n';
$data['headers'] .= "Content-Type: text/plain;charset=\"utf-8\"\r\n"; #EDIT: TYPO
$data['message'] = "BEGIN:VCALENDAR\r\n
VERSION:2.0\r\n
PRODID:-//Deathstar-mailer//theforce/NONSGML v1.0//EN\r\n
METHOD:REQUEST\r\n
BEGIN:VEVENT\r\n
UID:" . md5(uniqid(mt_rand(), true)) . "example.com\r\n
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z\r\n
DTSTART:".$data['date']."T".$data['startTime']."00Z\r\n
DTEND:".$data['date']."T".$data['endTime']."00Z\r\n
SUMMARY:".$data['subject']."\r\n
ORGANIZER;CN=".$data['organizer'].":mailto:".$data['organizer_email']."\r\n
LOCATION:".$data['location']."\r\n
DESCRIPTION:".$data['desc']."\r\n
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN".$data['participant_name_1'].";X-NUM-GUESTS=0:MAILTO:".$data['participant_email_1']."\r\n
END:VEVENT\r\n
END:VCALENDAR\r\n";
$data['headers'] .= $data['message'];
Mail::send(['html'=> 'emails.test'], $data, function ($message) use (&$order, &$data) {
$message->subject($data['subject']);
$message->from('fromtest@gmail.com', 'Krankontroller');
$message->to($data['to']);
});
return Redirect::back()->with($this->success, trans($this->sent_success));
}
My View page is:
<?php echo $headers; ?>
and my output is:
Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\nContent-Type: text/plain;charset="utf-8" BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Deathstar-mailer//theforce/NONSGML v1.0//EN METHOD:REQUEST BEGIN:VEVENT UID:21835d460dd0be889c405846ad40d9a3example.com DTSTAMP:20160801T054626Z DTSTART:20150812T080000Z DTEND:20150812T090000Z SUMMARY:Krankontrollen Estimation ORGANIZER;CN=Catherine:mailto:catherinegitanjali@gmail.com LOCATION:Redmont-Seattle DESCRIPTION:The purpose of the meeting is to discuss the capture of Krankontrollen Estimation and its crew. ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CNGitanjali;X-NUM-GUESTS=0:MAILTO:gita_cathy@yahoo.co.in END:VEVENT END:VCALENDAR
But what I'm expecting is:
It just print the headers and not giving the outlook event style. what mistake I made here? Can anyone help me, please? thanks in advance.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2aI6amX
via IFTTT
Aucun commentaire:
Enregistrer un commentaire