Yes there are - I am not sure which is correct, but even when I use them, it does not work.
content-type: text/calendar
and I also found this one
content-type: text/x-vcalendar
I tried using these in the headers, but then I do not know where to put the other information (the vcalendar code).
If this can not be done, I could do it another way. The first would be prefered, but perhaps if I let the user upload their vcalendar onto the server, and then from that code I could make a calendar. I do not know if this is possible, but if the first scenario does not work, then this one will do.
Thanks for all of your replies.
[subscribes to thread]
This will be really useful info when it all gets figured out! Please post some sample PHP code when you get things squared away for all of us to enjoy! /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
Hi again, I played around with some code that I found at http://www.scit.wlv.ac.uk/rfc/rfc24xx/RFC2447.html but that code is not intended for mail with php I think. Here is what I have thus far:
THat does NOT work. I am almost certain that I have something wrong in the headers. When the email comes through, it has all the header info and then the message.
Any suggestions? Thanks.
I don't know where the vcalendar part comes in, but I sent an appointment from my work account (Exchange 2003) using the Web mail interface, and this is what I got (email addresses etc edited)
Type:Single Meeting
Organizer:Paul Davey
Start Time:Saturday, January 29, 2005 12:30 PM
End Time:Saturday, January 29, 2005 1:00 PM
Time Zone:(GMT+08:00) Perth
Location:Home again
*~*~*~*~*~*~*~*~*~*
Message Body Here
In Outlook, it prompted me to accept/decline the appoiuntment when I opened the message (not an attachement). The message format was simple enough!
Hi Ladies and Gents,
So I have now tried everything that my mind can think - including taking out the method, changing it etc... I will be more than willing to read from tutorials or articles if any of you guys do know about this. And yes, tubbytreats I will post all the script here if I ever figure out how /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />.
Thanks!
Something you could try with your bit of code (or using Paul's) is explicitly adding a "\r\n" to the end of each header line. That may be the reason the headers are being dumped into the message.
The "\r\n" is the standard delimiter for each header. And since they are escape characters, they must be used in double quotes. Single quotes will treat them as a literal.
Here's a slight adjustment to your code using the data presented by Paul.
if (mail($email, $subject, $message, $headers)) {
echo 'Congrats on a job well done';
};
?>
Figured this was appropriate to the conversation...
HOW TO VIEW MESSAGE SOURCE IN OUTLOOK 2003:
http://www.outlook-tips.net/howto/view_source.htm
I can't get either Bob's or bobbymac's code to work here sending PHP mail() from a Windows IIS 6.0 server to an Outlook email account. I get an email, but it just has plaintext in it, and is NOT formatted as an Outlook "Appointment Request" message.
Here's what happens when I send a message from Outlook 2003 to an external webmail account:
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C50A06.FCD0B848
Content-Type: text/plain;
charset="iso-8859-1"
When: Thursday, February 03, 2005 11:00 AM-11:30 AM (GMT-05:00) Eastern Time
(US & Canada).
Where: This is the location
*~*~*~*~*~*~*~*~*~*
This is the body: Please plan to be at the meeting.
------_=_NextPart_001_01C50A06.FCD0B848
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.2">
<TITLE>This is the subject</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Arial">When: Thursday, February 03, 2005 11:00 AM-11:30 AM (GMT-05:00) Eastern Time (US & Canada).</FONT>
<BR><FONT SIZE=2 FACE="Arial">Where: This is the location</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">*~*~*~*~*~*~*~*~*~*</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">This is the body: Please plan to be at the meeting.</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C50A06.FCD0B848--
I've updated the previously posted code. There was a typo following the content-type. Sorry, I don't use a calendaring program so I couldn't test. With all that I learned, I'll install one soon enough. /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
To send in vCalendar format just send a .vcs file as an attachment. The contents of the file should have everything between and including the BEGIN: and END:VCALENDAR lines that was posted earlier. The suggestion about placing them as headers was a mistake.
Here are some key points that I've learned (some resources below).
1. There are two main calendar formats - vCalendar(.vcs) and iCalendar(.ics). Outlook seems to have its own thing but can support the others.
2. vCalendar is much easier to implement.
3. Method=Request. The method here tells Outlook if this is a request, reply, etc. It is not GET, POST, etc.
4. There are various levels of compliance, even across versions of Outlook, that need to be considered when developing. Basically, the newer the software, the more robust.
Other resources:
Using PHP to Make Basic vCalendar/iCalendar Events
MSDN Calendaring
Outlook 2000 and Outlook 2002 iCalendar interoperability problems
iCalendar PHP Class
vCalendar PHP Class
Outlook Appointments, ASP and vCalendar
vCal code for GeekLog
iCalendar File Builder Demo
Ok
After spending the whole day pasting code from several other sites, I accidentally found some code that will work. In the code, a user is registering for an event, and this script will set up a calendar event in the Outlook so they can accept/deny/etc
Please note that the Description is currently not working (tomorrow's task) for some reason.
$to = $formVars['email'];
$subject = "Training Registration";
$message = "Thank you for participating in the Technical Certification training program.\n\n";
//==================
$headers = 'Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\n';
$headers .= "Content-Type: text/plain;charset=\"utf-8\"\r\n"; #EDIT: TYPO
$messaje = "BEGIN:VCALENDAR\n";
$messaje .= "VERSION:2.0\n";
$messaje .= "PRODID:PHP\n";
$messaje .= "METHOD:REQUEST\n";
$messaje .= "BEGIN:VEVENT\n";
$messaje .= "DTSTART:" . $date_array[1] . $momth . $day1 . "T080000\n";
$messaje .= "DTEND:" . $date_array[1] . $momth . $day2. "T170000\n";
$messaje . "DESCRIPTION: You have registered for the class\n";
$messaje .= "SUMMARY:Technical Training\n";
$messaje .= "ORGANIZER; CN=\"Corporate\":mailto:training@corporate.com\n";
$messaje .= "Location:" . $location . "\n";
$messaje .= "UID:040000008200E00074C5B7101A82E00800000006FC30E6C39DC004CA782E0C002E01A81\n";
$messaje .= "SEQUENCE:0\n";
$messaje .= "DTSTAMP:".date('Ymd').'T'.date('His')."\n";
$messaje .= "END:VEVENT\n";
$messaje .= "END:VCALENDAR\n";
$headers .= $messaje;
mail($to, $subject, $message, $headers);
Finally works!!!
Hi,
I need to send an event through a php based application to outlook in the form of a calendar invitation. This is what i have so far
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ATTENDEE;CN=attender1@mail.com;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:attender1@mail.com
ATTENDEE;CN="Someones Name";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:attender2@mail.com
ORGANIZER:MAILTO:email@domain.com
DTSTART:20050128T000000Z
DTEND:20050128T003000Z
LOCATION:Head offce
TRANSP:OPAQUE
SEQUENCE:0
UID:040000008200E00074C5B7101A82E00800000000E010BD266504C5010000000000000000100
000004938F36FEDDF5248A54AB3A9EA980DBF
DTSTAMP:20050127T184133Z
DESCRIPTION:When: 27 January 2005 17:00-17:30 (GMT-07:00) Mountain Time
(US & Canada).\nWhere: Head
offce\n\n*~*~*~*~*~*~*~*~*~*\n\nYou have a board meeting scheduled!\n
SUMMARY:Testing
PRIORITY:5
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
This is what I got when I sent it to a non outlook calendar email client. How do I send this to a outlook calendar email client as an "event or appointment" through php mail - with variables added to the code.
I can do the variables, just have no idea how to sent it.
Thanks!
As it is now, it comes through as a text attachment. Does anybody have any ideas on what to do? Thanks!
JustMe