php - Yii, PHPMailer : how to send an email with HTML and ICS format -


i trying send email html , ics format gmail, outlook, yahoo, thunderbird, outlook express 2013 , iphone, able send ics format gmail, outlook , yahoo.

issue not able send html format in same mail
tried following code

public function createschedulenotification(){      $from = 'info@careervita.com';     $fromname = 'info';     $to = 'testcareervita@outlook.com';     $subject = 'invitation test demo';     $desc = 'this test demo invitaion';     $uid =  date('ymd').'t'.date('his')."-".rand();      $message =  "begin:vcalendar\r\n";     $message.=  "prodid:-//zoho crm//nonsgml calendar//en\r\n";     $message.=  "version:2.0\r\n";     $message.=  "x-wr-timezone:gmt\r\n";     $message.=  "x-wr-calname:zcrm\r\n";     $message.=  "method:request\r\n";     $message.=  "calscale:gregorian\r\n";     $message.=  "begin:vevent\r\n";     $message.=  "uid:".$uid."\r\n";     $message.=  "description:".$desc."\r\n";     $message.=  "organizer;cn= manisha:mailto:manisha.g@careervita.com\r\n";     $message.=  "dtstart:20150710t100010z\r\n";     $message.=  "dtend:20150710t110000z\r\n";     $message.=  "attendee;role=req-participant;partstat=needs-action;cn=vinod t:mailto:g_manisha@outlook.com\r\n";     $message.=  "attendee;role=req-participant;partstat=needs-action;cn=vivek j:mailto:manisha.gaidhane8788@gmail.com\r\n";     $message.=  "location:cv360\r\n";     $message.=  "created:20150701t060720z\r\n";     $message.=  "last-modified:20150701t060720z\r\n";     $message.=  "x-event-owner:1563791000000084003\r\n";     $message.=  "end:vevent\r\n";     $message.=  "end:vcalendar";      yii::import('application.extensions.phpmailer.jphpmailer');         $mailer = new jphpmailer(true);         if (yum::module()->phpmailer['transport'])             switch (yum::module()->phpmailer['transport']){                 case 'smtp':                     $mailer->issmtp();                     break;                 case 'sendmail':                     $mailer->issendmail();                     break;                 case 'qmail':                     $mailer->isqmail();                     break;                 case 'mail':                 default:                     $mailer->ismail();             }         else             $mailer->ismail();             $mailer->ishtml(true);          $mailerconf=yum::module()->phpmailer['properties'];         if(is_array($mailerconf))             foreach($mailerconf $key=>$value) {                 if(isset(jphpmailer::${$key}))                     jphpmailer::${$key} = $value;                 else                     $mailer->$key=$value;             }          $mailer->setfrom($from);          $mailer->addaddress($to);          $mailer->subject = $subject;         $mailer->body = $message;         $mailer->addcc('testcareervita@gmail.com', 'person one');         $mailer->addcc('testcareervita@yahoo.in', 'person two');          $mailer->contenttype = 'text/calendar';         $mailer->charset = 'utf-8';         $mailer->addcustomheader("mime-version : 1.0");         $mailer->addcustomheader('content-type : text/calendar; name="testcal.ics"; method=request;');         $mailer->addcustomheader('content-transfer-encoding:7bit'); //to interpret ics file         $mailer->addcustomheader("content-class: urn:content-classes:calendarmessage");          $mailer->addcustomheader('content-disposition : inline; filename="testcal.ics"');         return $mailer->send();  } 
  1. how send html data within same email?
  2. also outlook .ics file not getting download
    appreciable

you should not add custom headers - break things.

phpmailer includes simple ics generation class called easypeasyics. it's simple, important things. how use it, refer this example in test suite.

however you're generating it, stick ics data $mail->ical , added multipart/alternative text/calendar part alongside usual text/html , text/plain parts. tricky , unreliable in clients, , run trouble if try use attachments @ same time.

unfortunately phpmailer doesn't let build arbitrary mime structures, , messy support ical parts more comprehensively, in face of broken support in clients require messy workaround, this issue discusses.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -