I'm trying to run the following code that generates ICS. Pluck it off the net and when I run it via WAMP, it prompts an error that create a mail log as follows:
mail() on [C:\wamp\www\ical.php:79]:
To: [email protected] --
Headers: From: My Name <[email protected]>
Reply-To: My Name <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----Meeting Booking----caf27bb576bd8abd889197ec8c0ebaf5"
Content-class: urn:content-classes:calendarmessage
It says error is on line 79 which is:
$mail_sent = @MAIL( $email, $subject, $message, $headers );
Really puzzled on this. Any help???
    test.php    
<?PHP
    INCLUDE ("ical.php");
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>iCal Test</title>
    </head>
    <body>
    <?PHP
    //$firstname is the first name of target
    //$lastname is the last name of target
    //$email is the targets email address
    //$meeting_date is straight from a DATETIME mysql field and assumes UTC.
    //$meeting_name is the name of your meeting
    //$meeting_duration is the duration of your meeting in seconds (3600 = 1 hour)
    $firstname = "John";
    $lastname = "Smith";
    $email = "[email protected]";
    $meeting_date = "2010-07-06 13:40:00"; //mysql format
    $meeting_name = "Hello";
    $meeting_duration = 3600;
    //returns true or false
    $result = sendIcalEmail($firstname,$lastname,$email,$meeting_date,$meeting_name,$meeting_duration);
    //display result
    IF($result) {
        ECHO "Email sent successfully.";
    } ELSE {
        ECHO " $result ";// "A problem occurred sending email";
    }   
    ?>
    </body>
    </html>
ical.php
    <?PHP
    //$firstname is the first name of target
    //$lastname is the last name of target
    //$email is the targets email address
    //$meeting_date is straight from a DATETIME mysql field and assumes UTC.
    //$meeting_name is the name of your meeting
    //$meeting_duretion is the duration of your meeting in seconds (3600 = 1 hour)
    FUNCTION sendIcalEmail($firstname,$lastname,$email,$meeting_date,$meeting_name,$meeting_duration) {
        $from_name = "My Name";
        $from_address = "[email protected]";
        $subject = "Meeting Booking"; //Doubles as email subject and meeting subject in calendar
        $meeting_description = "Here is a brief description of my meeting\n\n";
        $meeting_location = "My Office"; //Where will your meeting take place
        //Convert MYSQL datetime and construct iCal start, end and issue dates
        $meetingstamp = STRTOTIME($meeting_date . " UTC");    
        $dtstart= GMDATE("Ymd\THis\Z",$meetingstamp);
        $dtend= GMDATE("Ymd\THis\Z",$meetingstamp+$meeting_duration);
        $todaystamp = GMDATE("Ymd\THis\Z");
        //Create unique identifier
        $cal_uid = DATE('Ymd').'T'.DATE('His')."-".RAND()."@mydomain.com";
        //Create Mime Boundry
        $mime_boundary = "----Meeting Booking----".MD5(TIME());
        //Create Email Headers
        $headers = "From: ".$from_name." <".$from_address.">\n";
        $headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
        $headers .= "Content-class: urn:content-classes:calendarmessage\n";
        //Create Email Body (HTML)
        $message = "";
        $message .= "--$mime_boundary\n";
        $message .= "Content-Type: text/html; charset=UTF-8\n";
        $message .= "Content-Transfer-Encoding: 8bit\n\n";
        $message .= "<html>\n";
        $message .= "<body>\n";
        $message .= '<p>Dear '.$firstname.' '.$lastname.',</p>';
        $message .= '<p>Here is my HTML Email / Used for Meeting Description</p>';    
        $message .= "</body>\n";
        $message .= "</html>\n";
        $message .= "--$mime_boundary\n";
        //Create ICAL Content (Google rfc 2445 for details and examples of usage) 
        $ical =    'BEGIN:VCALENDAR
    PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
    VERSION:2.0
    METHOD:PUBLISH
    BEGIN:VEVENT
    ORGANIZER:MAILTO:'.$from_address.'
    DTSTART:'.$dtstart.'
    DTEND:'.$dtend.'
    LOCATION:'.$meeting_location.'
    TRANSP:OPAQUE
    SEQUENCE:0
    UID:'.$cal_uid.'
    DTSTAMP:'.$todaystamp.'
    DESCRIPTION:'.$meeting_description.'
    SUMMARY:'.$subject.'
    PRIORITY:5
    CLASS:PUBLIC
    END:VEVENT
    END:VCALENDAR';   
        $message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST\n';
        $message .= "Content-Transfer-Encoding: 8bit\n\n";
        $message .= $ical;            
        //SEND MAIL
        $mail_sent = @MAIL( $email, $subject, $message, $headers );
        IF($mail_sent)     {
            RETURN TRUE;
        } ELSE {
            RETURN FALSE;
        }   
    }
    ?>
				
                        
Just use
@mailreplace it withmailReference PHP mail