2017-07-12 11 views
7

मैं लैरवेल के मेल एपीआई का उपयोग करके कैलेंडर आमंत्रण भेज रहा हूं।कैलेंडर आमंत्रण आईसीएस फ़ाइल के रूप में प्राप्त किया जाता है - लार्वेल

कैलेंडर जीमेल पर अच्छा दिखता है लेकिन उचित कैलेंडर आमंत्रण के बजाय दृष्टिकोण पर अनुलग्नक दिखाता है।

जीमेल की उत्पादन:

enter image description here

जबकि दृष्टिकोण पर यह लगाव हो रहा है:

enter image description here

मैं नाम invite.ics और मैं के साथ एक फ़ाइल बनाने हूँ सामग्री को edit.ics फ़ाइल के अंदर रखें, मैं ईमेल भेजते समय फ़ाइल संलग्न करता हूं।

$to = $row->to; 
$subject = $row->subject; 
$attachments = $row->attachment; 
$cc = $row->cc; 
$body = $row->body; 
$calendar_invitation = $row->calendar_invitation; 

\Mail::send(
'emailTemplates.dummy', 
['emailBody'=>$row->body], 
function(Message $message) use ($to,$subject,$attachments,$cc, $body, $calendar_invitation, $companyEmail) 
{ 
    $message->from($companyEmail, ''); 
    $message->replyTo($companyEmail, 'Email Agent Evmeetings'); 
    $message->to($to, '')->subject($subject); 
    $file = fopen("invite.ics","w"); 
    echo fwrite($file,$calendar_invitation); 
    fclose($file); 
    $message->attach('invite.ics', array('mime' => "text/calendar")); 


}); 
+0

क्या आपने '$ message-> संलग्न ('login.ics', array ('mime' => 'text/calendar; charset =" utf-8 "; विधि = अनुरोध')) की कोशिश की है? – alepeino

+0

मुझे लगता है मैंने किया, मैं फिर से कोशिश करूंगा @alepeino –

+0

@alepeino यह काम नहीं किया –

उत्तर

4

ऐसा इसलिए है कि कैसे मैं यह काम

$message->from($companyEmail, ''); 
$message->replyTo($companyEmail, 'Email Agent Evmeetings'); 
$message->to($to, '')->subject($subject); 
$message->setBody($calendar_invitation, 'text/calendar; charset="utf-8"; method=REQUEST'); 
$message->addPart($body, "text/html"); 

जोड़ा शरीर में कैलेंडर बनाया था और 'text/calendar; charset="utf-8"; method=REQUEST'

को माइम प्रकार बदल गया है और addPart($body, "text/html"); विधि का इस्तेमाल किया ईमेल में एचटीएमएल शरीर जोड़ने के लिए।

संबंधित मुद्दे