File "mail02.php"

Full Path: /home/analogde/www/humour/Massage_new/mail02.php
File size: 2.31 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * sends an iCal event mail
 * @param Timestamp $tsStart - timestart of the start time
 * @param Timestamp $tsEnd - timestamp of end date
 * @param String $location - location of event
 * @param String $summary - event summary
 * @param String $to - list of email recipients
 * @param String $subject - email subject
 */
 
 //http://blog.sebastian-martens.de/2012/01/submit-outlook-calendar-invitations-with-php/
 
 
 
 
	$tsStart = 1452776400; // 14 janvier à 14H
	$tsEnd = 1452777600   // 14 jabvier à 14H20
	$location = "bistro";
	$summary = "blabla";
	$title = "titre";
	$resources "salle N10";
	$to = "patrice.delpy@onsemi.com";
	$subject = "debug mailling";
	
	echo sendCal( $tsStart, $tsEnd, $location, $summary, $title, $resources, $to, $subject );
 
function sendCal( $tsStart, $tsEnd, $location, $summary, $title, $resources, $to, $subject )
{
 
	$pipo = "patoche":
 
	$from = ORGANISATIONREPLYMAIL;
	$dtstart = date('Ymd',$tsStart).'T'.date('His',$tsStart);
	$dtend = date('Ymd',$tsEnd).'T'.date('His',$tsEnd);
	$loc = $location;
 
	$vcal = "BEGIN:VCALENDAR\r\n";
	$vcal .= "VERSION:2.0\r\n";
	$vcal .= "PRODID:-//nonstatics.com//OrgCalendarWebTool//EN\r\n";
	$vcal .= "METHOD:REQUEST\r\n";
	$vcal .= "BEGIN:VEVENT\r\n";
	$vcal .= "ORGANIZER;CN=\"".ORGANISATIONNAME." (".$pipo.")"."\":mailto:".ORGANISATIONREPLYMAIL."\r\n";
	$vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-nonstatics.com\r\n";
	$vcal .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";
	$vcal .= "DTSTART:$dtstart\r\n";
	$vcal .= "DTEND:$dtend\r\n"; 
	$vcal .= "LOCATION:$location\r\n";
	$vcal .= "SUMMARY:$summary\r\n";
	$vcal .= "DESCRIPTION:Hinweis/Fahrer:$summary - Folgende Resourcen wurden gebucht: $resources \r\n";
	$vcal .= "BEGIN:VALARM\r\n";
	$vcal .= "TRIGGER:-PT15M\r\n";
	$vcal .= "ACTION:DISPLAY\r\n";
	$vcal .= "DESCRIPTION:Reminder\r\n";
	$vcal .= "END:VALARM\r\n";
	$vcal .= "END:VEVENT\r\n";
	$vcal .= "END:VCALENDAR\r\n";
 
	$headers = "From: $from\r\nReply-To: $from"; 
	$headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; name=calendar.ics; method=REQUEST; charset=\"iso-8859-1\"";
	$headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0"; 
 
	return @mail($to, $subject . " " . $summary . " / " . $resources, $vcal, $headers);
}
?>