我已经成功在电子邮件上获取了iCalendar附件(.ics文件)。但是,现在,电子邮件正文为空。有没有办法填充电子邮件的正文并将.ics文件附加到同一电子邮件上?
期望电子邮件正文是这样的
到目前为止我的代码
<?php
$ics_data = 'BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
LOCATION:BTM Bangalore
DESCRIPTION:ICS Test Event
SUMMARY;LANGUAGE=en-US:Team Building meeting
DTSTART:20190712T214000
DTEND:20190712T225000
SUMMARY:
URL;VALUE=URI:dev.speakerengage.com
DTSTAMP:20190712T165600Z
UID:5d247ec5c0214
END:VEVENT
END:VCALENDARCould not access file: invite.ics
1
';
file_put_contents("invite.ics",$ics_data);
$html='<h4>Hello Friend,<br> This is a meeting request.</h4>';
echo smtp_mailer('manjunath.m@iverbinden.com','Dear User',$html);
function smtp_mailer($to,$subject, $msg){
require_once("smtp/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'TLS';
$mail->Host = "smtp.sendgrid.net";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Username = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$mail->Password = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
$mail->SetFrom("noreply@iverbinden.com");
$mail->addAttachment("invite.ics");
$mail->Subject = $subject;
$mail->Body =$msg;
$mail->AddAddress($to);
if(!$mail->Send()){
return 0;
}else{
return 1;
}
}
?>
有人可以帮我吗?预先感谢。