Old 18-11-2008, 08:17   #1 (permalink)
Pete Nice
Crankshaft
 
Pete Nice's Avatar
 
Join Date: Apr 2003
Posts: 2,108
PHP mail calendar reminder

Hi all,

Was wondering of anyone knows how to send an email with php as a calendar reminder. i.e. sending the contents of an .ics file as the email rather than as an attachment.

TIA
  Reply With Quote
Old 18-11-2008, 11:14   #2 (permalink)
Pete Nice
Crankshaft
 
Pete Nice's Avatar
 
Join Date: Apr 2003
Posts: 2,108
Don't worry - I've sorted it myself.
  Reply With Quote
Old 18-11-2008, 13:12   #3 (permalink)
PointandStare
Watch it sonny
 
PointandStare's Avatar
 
Join Date: Jul 2008
Posts: 1,526
Send a message via MSN to PointandStare Send a message via Skype™ to PointandStare
Do you mind sharing in case someone else is looking?
__________________
  Reply With Quote
Old 19-11-2008, 05:34   #4 (permalink)
Pete Nice
Crankshaft
 
Pete Nice's Avatar
 
Join Date: Apr 2003
Posts: 2,108
Quote:
Do you mind sharing in case someone else is looking?

You doing a sub on me?

OK - here's what I have:

Code:
<?php if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { $eol="\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { $eol="\r"; } else { $eol="\n"; } $subject = 'Meeting Subject Here'; $email = 'email@email.com'; $message = <<<END BEGIN:VCALENDAR VERSION:2.0 METHOD:REQUEST BEGIN:VEVENT DTSTART:20081208T120000 DTEND:20081208T140000 SUMMARY:Title of event here ORGANIZER;RSVP=TRUE;CN=Your Name;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:\n email@email.com\n ATTENDEE;RSVP=TRUE;CN=Your Name;PARTSTAT=NEEDS-ACTION;\n ROLE=REQ PARTICIPANT:mailto:email@email.com\n SEQUENCE:0 Location:London END:VEVENT END:VCALENDAR END; $headers = "From: email@email.com".$eol; $headers .= "MIME-version: 1.0".$eol; $headers .= "Content-class: urn:content-classes:calendarmessage".$eol; $headers .= "Content-type: text/calendar; method=REQUEST; charset=UTF-8".$eol; $headers .= "Content-transfer-encoding: 8BIT".$eol; mail($email,$subject,$message,$headers); ?>

Last edited by Pete Nice : 19-11-2008 at 05:52.
  Reply With Quote
Old 25-11-2008, 18:24   #5 (permalink)
Pete Nice
Crankshaft
 
Pete Nice's Avatar
 
Join Date: Apr 2003
Posts: 2,108
I'm bumping this post - cos I need some help - this shit ain't working. Well I say it aint working - it's works on a mac in entourage and thunderbird. But Outlook is being a bitch - I think it has to do with CRLF on a PC.

I really need some ideas on this one - I'm stressed up to the eyeballs at work and I really need a solution to this fucker asap - this is the latest code I have:

Code:
<?php $subject = 'Email Subject'; $email = $_POST['email']; $email1 = $_POST['email1']; $message = "BEGIN:VCALENDAR\r\n"; $message .= "METHOD:PUBLISH\r\n"; $message .= "VERSION:2.0\r\n"; $message .= "BEGIN:VEVENT\r\n"; $message .= "SEQUENCE:5\r\n"; $message .= "LOCATION:London\r\n"; $message .= "DTSTART:20081208T120000\r\n"; $message .= "DTSTAMP:20021028T011706Z\r\n"; $message .= "SUMMARY:Event Title\r\n"; $message .= "UID:EC9439B1-FF65-11D6-9973-003065F99D04\r\n"; $message .= "DTEND:20081208T140000\r\n"; $message .= "BEGIN:VALARM\r\n"; $message .= "TRIGGER;VALUE=DURATION:-P1D\r\n"; $message .= "ACTION:DISPLAY\r\n"; $message .= "DESCRIPTION:Event Description\r\n"; $message .= "END:VALARM\r\n"; $message .= "END:VEVENT\r\n"; $message .= "END:VCALENDAR\r\n"; $headers = "From: email@email.com\r\n"; $headers .= "MIME-version: 1.0\r\n"; $headers .= "Content-type: text/calendar; method=PUBLISH; charset=UTF-8\r\n"; $headers .= "Content-transfer-encoding: 7bit\r\n"; mail($email,$subject,$message,$headers); mail($email1,$subject,$message,$headers); ?>
  Reply With Quote
Old 25-11-2008, 19:06   #6 (permalink)
Pete Nice
Crankshaft
 
Pete Nice's Avatar
 
Join Date: Apr 2003
Posts: 2,108
right - I've just tried this in a gmail account - didn't work until I took out the \r\n on the last header and it worked.

Could this be a reason it doesn't work in outlook?

I don't have the ability to test in outlook as I'm on a mac
  Reply With Quote
Old 25-11-2008, 19:50   #7 (permalink)
Shiro
Whitey
 
Shiro's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 7,319
I don't know shit about google calendars. But Macs and Windows have different from 'nix line endings.

Gotta leave for work in 2 minutes, so no time to say much. Scan through this:

Newline - Wikipedia, the free encyclopedia
__________________
This space for rent.

After Hours Japan
  Reply With Quote
Old 26-11-2008, 09:15   #8 (permalink)
Pete Nice
Crankshaft
 
Pete Nice's Avatar
 
Join Date: Apr 2003
Posts: 2,108
it's fine - got it sorted eventually
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive
Web Hosting by Heart Internet, vBulletin © 2000-2009 Jelsoft Enterprises Limited.
Search Engine Optimization by vBSEO 3.0.0 RC8
Web Hosting by Heart Internet