我想在我的邮件正文中添加一条消息文本但无法成功。当我将$ mail-> Body =“Blablabla”添加到我的代码中时,它不会读取变量。 我必须使用另一个标题吗?有些资源会很棒
EDİT:当我写这篇文章时:
$content = '<div style="background: #eee; padding: 10px; font-size: 14px">Bu bir test e-posta\'dır..</div>';
$mail->MsgHTML($content);
在$mail->Body = $ical;
之前没有日历,但它会打印字符串。但是如果我把代码放在那之后就打印出所有的代码。
$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;
}}
?>
答案 0 :(得分:-1)
您需要将$mail->IsHTML(true);
放在$mail->Body = $ical;