xenophobia Posted May 7, 2009 Share Posted May 7, 2009 Hi guys, I have some special problem requirement over the PHPMAILER class. Normally we would send normal text/plain, text/html, image/jpeg content-type. So these content-type normally callup using the: AddEmbeddedImage, MsgHTML, or the normal plain text would just use $mailer->Body = "some plain text here"; But now, I need to add in the ical content into the mail. What method should I use? I don't mind enter all the content-type by myself as long there is a custom content type function for me to do so. Anyone here got the idea of what I want? Thanks! Link to comment https://forums.phpfreaks.com/topic/157171-solved-phpmailer-custom-content/ Share on other sites More sharing options...
xenophobia Posted May 8, 2009 Author Share Posted May 8, 2009 Abit improvement, I found that I can use the "AddEmbeddedImage" to add in an ical content as an attachment. $mailer->AddEmbeddedImage("ical.php", "meeting", "meeting.ics", "7bit", "text/calendar; charset=utf-8; method=REQUEST"); provided, my ical.php must be like this: BEGIN:VCALENDAR PRODID:Zimbra-Calendar-Provider VERSION:2.0 METHOD:REQUEST BEGIN:VTIMEZONE TZID:(GMT+09.00) Seoul BEGIN:STANDARD DTSTART:19710101T000000 TZOFFSETTO:+0900 TZOFFSETFROM:+0900 END:STANDARD END:VTIMEZONE BEGIN:VEVENT UID:2e073fc1-01af-418d-b257-30216748498d SUMMARY:test LOCATION:sf\;k\;dl ATTENDEE;CN=kent;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto :[email protected] ORGANIZER;CN=ChiamYH:mailto:[email protected] DTSTART;TZID="(GMT+09.00) Seoul":20090506T000000 DTEND;TZID="(GMT+09.00) Seoul":20090507T000000 STATUS:CONFIRMED CLASS:PUBLIC X-MICROSOFT-CDO-ALLDAYEVENT:TRUE X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY TRANSP:OPAQUE X-MICROSOFT-DISALLOW-COUNTER:TRUE DTSTAMP:20090505T041211Z SEQUENCE:0 DESCRIPTION:The following is a new meeting request:\n\nSubject: test \nOrgan izer: \"ChiamYH\" <[email protected]> \n\nLocation: sf\;k\;dl \nTime: Wedn esday\, May 6\, 2009\, All day\n \nInvitees: \"kent\" <[email protected]> \n\ n*~*~*~*~*~*~*~*~*~*\n\n BEGIN:VALARM ACTION:DISPLAY TRIGGER;RELATED=START:-PT1080M DESCRIPTION:Reminder END:VALARM END:VEVENT END:VCALENDAR When I sent out this mail, the recipient able to recognize the ical format and add it into the client's calendaring (Outlook). The major problem is, my ical.php, I can't put in any processing unit. Meaning the PHPMailer instead of process and output, it will just copy and output. Eg in my ical.php: <?php echo "hello world"; ?> The mail sent out will exactly same as above instead of: 'hello world'. So what I need now is, instead of passing the file path of the attachment, I want to pass in the content of the attachment, eg: $mailer->AddEmbeddedImage("all my content here, just put this as attachment!!!", "meeting", "meeting.ics", "7bit", "text/calendar; charset=utf-8; method=REQUEST"); This topic can search by google: phpmailer add ical. help me out guys!! Link to comment https://forums.phpfreaks.com/topic/157171-solved-phpmailer-custom-content/#findComment-829112 Share on other sites More sharing options...
xenophobia Posted May 8, 2009 Author Share Posted May 8, 2009 Okay, finally found this function: AddStringAttachment(). I did't get this listed from the API. $mailer->AddStringAttachment("my_content_here", "meeting.ics", "7bit", "text/calendar; charset=utf-8; method=REQUEST"); Done. Hope this help others. Link to comment https://forums.phpfreaks.com/topic/157171-solved-phpmailer-custom-content/#findComment-829136 Share on other sites More sharing options...
JulianYoung Posted July 8, 2009 Share Posted July 8, 2009 Spent the last couple of days working on this with PHPMailer I couldn't get this working with buttons enabled, kept giving me the dreaded "As the meeting organizer, you do not need to respond to the meeting". Without buttons however it worked fine. It gave me an iCal attachment but nothing else in Outlook (although Googlemail worked fine!). I eventually wrote my own script simply to handle iCal attachments, the problem seemed to stem from how the email headers were generated. I'm not sure how much direct control PHPMailer actually gives you over that. Anyway, I wrote it all up if anyone gets here, gets stumped like me and wonders where to turn next. Hope it helps and thanks xenophobia for at least helping me along the path a little -> iCal PHP Email Script Link to comment https://forums.phpfreaks.com/topic/157171-solved-phpmailer-custom-content/#findComment-870957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.