Jump to content

[SOLVED] PHPMAILER - Custom Content.


xenophobia

Recommended Posts

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
Share on other sites

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
:kent@netregy.com
ORGANIZER;CN=ChiamYH:mailto:chiamyh@netregy.com
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\" <chiamyh@netregy.com> \n\nLocation: sf\;k\;dl \nTime: Wedn
esday\, May 6\, 2009\, All day\n \nInvitees: \"kent\" <kent@netregy.com> \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.  ;D

 

help me out guys!!  :-[

Link to comment
Share on other sites

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
Share on other sites

  • 2 months later...

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.