I wanna add a message text into my mail body but couldn't make it. When I add $mail->Body="Blablabla" into my code it doesn't read the variable. Do I have to use another header? Some resources would be great
EDİT: when i write this:
$content = '<div style="background: #eee; padding: 10px; font-size: 14px">Bu bir test e-posta\'dır..</div>';
$mail->MsgHTML($content);
before $mail->Body = $ical;
there is no calendar but it prints the string. But if i put the code after that it prints all ical codes.
$venue = $place1;
$start = $tarih_duzen;
$start_time = $rz_baslama_saat;
$end = $tarih_duzen_bit;
$end_time = $rz_bit_saat;
$status = 'TENTATIVE';
$sequence = 0;
$event_id = 1234;
//$event['description'] = "<table border=1><tr><td>qqqq</td></tr><table>";
//PHPMailer
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Host = '127.0.0.1'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'someuser'; // SMTP username
$mail->Password = 'somepassword';
$mail->Port = 25;
$mail->IsHTML(true);
$mail->setFrom( "aa", 'Lâv');
$mail->addReplyTo( "aa", 'Lâv');
$mail->addAddress($email, $isim_etkinlik_katilimcilar);
$mail->ContentType = 'text/calendar';
$mail->Subject = "Oluşturulan Etkinlik";
//$mail->addCustomHeader('MIME-version',"1.0");
$mail->addCustomHeader('Content-type',"text/calendar; method=REQUEST;");
$mail->CharSet = 'iso-8859-9';
//$mail->addCustomHeader('Content-Transfer-Encoding',"7bit");
//$mail->addCustomHeader('X-Mailer',"Microsoft Office Outlook 12.0");
//$mail->addCustomHeader("Content-class: urn:content-classes:calendarmessage");
$ical = "BEGIN:VCALENDAR\r\n";
$ical .= "VERSION:2.0\r\n";
$ical .= "PRODID:-//YourCassavaLtd//EateriesDept//EN\r\n";
$ical .= "METHOD:REQUEST\r\n";
$ical .= "BEGIN:VEVENT\r\n";
$ical .= "ORGANIZER;SENT-BY=\"MAILTO:'$email'\":MAILTO:'$email'\r\n";
$ical .= "ATTENDEE;CN= $etkinligi_yapan_mail;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto: $etkinligi_yapan_mail\r\n";
$ical .= "UID:".strtoupper(md5($event_id))."-kaserver.com\r\n";
$ical .= "SEQUENCE:".$sequence."\r\n";
$ical .= "STATUS:".$status."\r\n";
$ical .= "DTSTAMPTZID=Africa/Nairobi:".date('Ymd').'T'.date('His')."\r\n";
$ical .= "DTSTART:".$start."T".$start_time."\r\n";
$ical .= "DTEND:".$end."T".$end_time."\r\n";
$ical .= "LOCATION:".$venue."\r\n";
$ical .= "SUMMARY:".$summary."\r\n";
//$ical .= "DESCRIPTION:".$meeting_des."\r\n";
$ical .= "BEGIN:VALARM\r\n";
$ical .= "TRIGGER:-PT15M\r\n";
$ical .= "ACTION:DISPLAY\r\n";
$ical .= "DESCRIPTION:Reminder\r\n";
$ical .= "END:VALARM\r\n";
$ical .= "END:VEVENT\r\n";
$ical .= "END:VCALENDAR\r\n";
$mail->Body = $ical;
//send the message, check for errors
if(!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
return false;
} else {
echo "Message sent!";
return true;
}}
?>