PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 17th, 2003, 07:23 AM
Jason Tesser Jason Tesser is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Wisconson
Posts: 5 Jason Tesser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question PHP Mail to Outlook Calendar

I have a form that gets sent email using php mail function. I would like to format part of the email message so that Outlook recognizes it as a calendar event. This would be really helpful. Does anyone know how to do this. It's gotto be possible. Though it is Microsoft. :-)

Reply With Quote
  #2  
Old February 19th, 2003, 06:02 AM
Jason Tesser Jason Tesser is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Wisconson
Posts: 5 Jason Tesser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can't someone help


Reply With Quote
  #3  
Old February 19th, 2003, 06:19 AM
timepoint5 timepoint5 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: bayern
Posts: 17 timepoint5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I dont think thats possible. Otherwise spam emails would mess up the diarys of the people ...

Reply With Quote
  #4  
Old February 19th, 2003, 06:43 AM
Jason Tesser Jason Tesser is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Wisconson
Posts: 5 Jason Tesser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
possible

It has to be possible if someone the the format for a calander event in Outlook. I think that it is just a message with a particular formatting. Outlook hides the format though if you try to view it. :-( grumble microsoft.

Reply With Quote
  #5  
Old February 21st, 2003, 05:34 AM
Jason Tesser Jason Tesser is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Wisconson
Posts: 5 Jason Tesser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
still no help

Reply With Quote
  #6  
Old February 1st, 2004, 08:15 AM
masiat masiat is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 masiat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I do not know, but i have found that you can add ebay-auctions to outlook calendar, so it should be possible. I would also need to knwo how..!

Reply With Quote
  #7  
Old October 19th, 2008, 05:28 PM
cesarcesar cesarcesar is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 1 cesarcesar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 23 sec
Reputation Power: 0
did this ever get solved? Im looking to do the same thing. thanks.

Reply With Quote
  #8  
Old January 7th, 2009, 10:46 AM
john_fallentine john_fallentine is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 2 john_fallentine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 31 sec
Reputation Power: 0
ICS attachment

I think this is what you are looking for:


bradym.net/php/creating-icalendar-ics-files-with-php

Reply With Quote
  #9  
Old January 12th, 2009, 09:11 AM
john_fallentine john_fallentine is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 2 john_fallentine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 31 sec
Reputation Power: 0
Outlook Calendar Email

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";
$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:040000008200E00074C5B7101A82E00800000006FC30E6 C39DC004CA782E0C002E01A81\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!!!

Reply With Quote
  #10  
Old April 6th, 2009, 12:36 PM
cravoley cravoley is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 1 cravoley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 22 sec
Reputation Power: 0
Quote:
PHP Code:
 $messaje "DESCRIPTION: You have registered for the class\n"



You forgot the = on this line :P

PHP Code:
 $messaje .= "DESCRIPTION: You have registered for the class\n"

Reply With Quote
  #11  
Old April 12th, 2009, 07:51 AM
amjmatrix amjmatrix is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 1 amjmatrix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 16 sec
Reputation Power: 0
No able to do \n in describtion section

Hi,
thanks heaps for publishing this script. Thi shelped heaps. I just have a small issue. When I try to ammend the desscription below after \n it does not display it in the calendar.

Works:
$messaje .= "DESCRIPTION: You have registered for the class\n";

Doesn't work
$messaje .= "DESCRIPTION: You have registered for the class\n" . "Please click below"\n;

I can't get anything to display after the first \n.

Did you come accross this. Any tips?

This is driving me crazy.

Cheers, amjmatrix

Reply With Quote
  #12  
Old April 28th, 2009, 09:30 AM
4GoGo 4GoGo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 1 4GoGo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 22 sec
Reputation Power: 0
I've got this one working too but and Outlook smess to recognize it as a calendar item but,
I am not able to accept an item. THe only way I can get it into my Calendar is bij moving it to the folder (right-mouse). Is it possible to get an Accept-button like you have when you send it through e-mail to a person?

Reply With Quote
  #13  
Old August 6th, 2009, 12:17 PM
keoflex keoflex is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 1 keoflex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 45 sec
Reputation Power: 0
I have completed a working ical through php

Quote:
Originally Posted by 4GoGo
I've got this one working too but and Outlook smess to recognize it as a calendar item but,
I am not able to accept an item. THe only way I can get it into my Calendar is bij moving it to the folder (right-mouse). Is it possible to get an Accept-button like you have when you send it through e-mail to a person?


first create a folder in root directory and call it icsFile
inside this filder create a blank text file called calendar.txt

now create a php in the root directory called icalEmail.php and past the following code

PHP Code:
<?php

$dtStart 
'20090808T131415Z';//yyyymmddThhmmssZ
$dtEnd '20090808T151617Z';
//--------------------
//create text file
$ourFileName "icsFile/calendar.txt";
$ourFileHandle fopen($ourFileName'w') or die("can't open file1");
fclose($ourFileHandle);
//
//edit temp file
$myFile "icsFile/calendar.txt";
$fh fopen($myFile'w') or die("can't open file2");

$stringData "
BEGIN:VCALENDAR\n 
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN\n 
VERSION:2.0\n 
METHOD:REQUEST\n 
BEGIN:VEVENT\n 
ORGANIZER:MAILTO:organizer@domain.com\n 
DTSTAMP:"
.date('Ymd').'T'.date('His')."\n
DTSTART:
$dtStart\n 
DTEND:
$dtEnd\n 
TRANSP:OPAQUE\n 
SEQUENCE:0\n 
UID:"
.date('Ymd').'T'.date('His')."-".rand()."-domain.com\n 
SUMMARY:do something someware\n 
DESCRIPTION:  This is just a test\n
PRIORITY:5\n 
X-MICROSOFT-CDO-IMPORTANCE:1\n 
CLASS:PUBLIC\n 
END:VEVENT\n 
END:VCALENDAR"
;
fwrite($fh$stringData);
fclose($fh);


//email temp file
    
$fileatt "icsFile/calendar.txt"// Path to the file
    
$fileatt_type "application/octet-stream"// File Type
    
$fileatt_name "ical.ics"// Filename that will be used for the file as the attachment
    
    
$email_from "fromPerson@domain.com"// Who the email is from
    
$email_subject "Email test"// The Subject of the email
    
$email_message "this is a sample message \n\n next line \n\n next line"// Message that the email has in it
    
    
$email_to "toPerson@domain.com"// Who the email is too
    
    
$headers "From: ".$email_from;
    
    
$file fopen($fileatt,'rb');
    
$data fread($file,filesize($fileatt));
    
fclose($file);
    
    
$semi_rand md5(time());
    
$mime_boundary "==Multipart_Boundary_x{$semi_rand}x";
    
    
$headers .= "\nMIME-Version: 1.0\n" .
    
"Content-Type: multipart/mixed;\n" .
    
" boundary=\"{$mime_boundary}\"";
    
    
$email_message .= "This is a multi-part message in MIME format.\n\n" .
    
"--{$mime_boundary}\n" .
    
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
    
"Content-Transfer-Encoding: 7bit\n\n" .
    
$email_message "\n\n";
    
    
$data chunk_split(base64_encode($data));
    
    
$email_message .= "--{$mime_boundary}\n" .
    
"Content-Type: {$fileatt_type};\n" .
    
" name=\"{$fileatt_name}\"\n" .
    
//"Content-Disposition: attachment;\n" .
    //" filename=\"{$fileatt_name}\"\n" .
    
"Content-Transfer-Encoding: base64\n\n" .
    
$data "\n\n" .
    
"--{$mime_boundary}--\n";
    
    
$ok = @mail($email_to$email_subject$email_message$headers);
    
    if(
$ok) {
    
    } else {
    die(
"Sorry but the email could not be sent. Please go back and try again!");
    } 
    
?>

Reply With Quote
  #14  
Old October 18th, 2013, 04:29 PM
kishoresai438 kishoresai438 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2013
Posts: 1 kishoresai438 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 33 sec
Reputation Power: 0
Thumbs up Timezone implementation

Great Implementation. I am getting Timezone issues by using this code. Can you tell me how can i pass timezones with date-time to outlook. Except that problem, i am getting everything. I need to set EST timezone to my mails.


Quote:
Originally Posted by keoflex
first create a folder in root directory and call it icsFile
inside this filder create a blank text file called calendar.txt

now create a php in the root directory called icalEmail.php and past the following code

PHP Code:
<?php

$dtStart 
'20090808T131415Z';//yyyymmddThhmmssZ
$dtEnd '20090808T151617Z';
//--------------------
//create text file
$ourFileName "icsFile/calendar.txt";
$ourFileHandle fopen($ourFileName'w') or die("can't open file1");
fclose($ourFileHandle);
//
//edit temp file
$myFile "icsFile/calendar.txt";
$fh fopen($myFile'w') or die("can't open file2");

$stringData "
BEGIN:VCALENDAR\n 
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN\n 
VERSION:2.0\n 
METHOD:REQUEST\n 
BEGIN:VEVENT\n 
ORGANIZER:MAILTO:organizer@domain.com\n 
DTSTAMP:"
.date('Ymd').'T'.date('His')."\n
DTSTART:
$dtStart\n 
DTEND:
$dtEnd\n 
TRANSP:OPAQUE\n 
SEQUENCE:0\n 
UID:"
.date('Ymd').'T'.date('His')."-".rand()."-domain.com\n 
SUMMARY:do something someware\n 
DESCRIPTION:  This is just a test\n
PRIORITY:5\n 
X-MICROSOFT-CDO-IMPORTANCE:1\n 
CLASS:PUBLIC\n 
END:VEVENT\n 
END:VCALENDAR"
;
fwrite($fh$stringData);
fclose($fh);


//email temp file
    
$fileatt "icsFile/calendar.txt"// Path to the file
    
$fileatt_type "application/octet-stream"// File Type
    
$fileatt_name "ical.ics"// Filename that will be used for the file as the attachment
    
    
$email_from "fromPerson@domain.com"// Who the email is from
    
$email_subject "Email test"// The Subject of the email
    
$email_message "this is a sample message \n\n next line \n\n next line"// Message that the email has in it
    
    
$email_to "toPerson@domain.com"// Who the email is too
    
    
$headers "From: ".$email_from;
    
    
$file fopen($fileatt,'rb');
    
$data fread($file,filesize($fileatt));
    
fclose($file);
    
    
$semi_rand md5(time());
    
$mime_boundary "==Multipart_Boundary_x{$semi_rand}x";
    
    
$headers .= "\nMIME-Version: 1.0\n" .
    
"Content-Type: multipart/mixed;\n" .
    
" boundary=\"{$mime_boundary}\"";
    
    
$email_message .= "This is a multi-part message in MIME format.\n\n" .
    
"--{$mime_boundary}\n" .
    
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
    
"Content-Transfer-Encoding: 7bit\n\n" .
    
$email_message "\n\n";
    
    
$data chunk_split(base64_encode($data));
    
    
$email_message .= "--{$mime_boundary}\n" .
    
"Content-Type: {$fileatt_type};\n" .
    
" name=\"{$fileatt_name}\"\n" .
    
//"Content-Disposition: attachment;\n" .
    //" filename=\"{$fileatt_name}\"\n" .
    
"Content-Transfer-Encoding: base64\n\n" .
    
$data "\n\n" .
    
"--{$mime_boundary}--\n";
    
    
$ok = @mail($email_to$email_subject$email_message$headers);
    
    if(
$ok) {
    
    } else {
    die(
"Sorry but the email could not be sent. Please go back and try again!");
    } 
    
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP Mail to Outlook Calendar


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap