在最近的几个小时中,我一直在拔头发。
下面是我的PHPMailer设置,在没有iCal附件的情况下发送时绝对可以正常工作:
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.office365.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 'donotreply@xxxxxx.ca';
$mail->Password = 'xxxxxx';
$mail->SetFrom('donotreply@xxxxxx.ca', 'My App');
$mail->addAddress('mygmailaddress@gmail.com', 'ToEmail');
现在,当我尝试向邮件添加iCal附件时,由于邮件未发送,我收到以下错误消息:
Failed to process message due to a permanent exception with message. A message can't be sent because it contains no recipients.
这是我添加了iCal的设置:
$ical_content = "BEGIN:VCALENDAR
VERSION:2.0
PRODID://Drupal iCal API//EN
BEGIN:VEVENT
UID:http://www.icalmaker.com/event/d8fefcc9-a576-4432-8b20-40e90889affd
DTSTAMP:20190203T045941Z
DTSTART:20190214T060000Z
DTEND:20190214T100000Z
SUMMARY:Party in Daawat
LOCATION:Hotel Daawat
DESCRIPTION:Dinner
END:VEVENT
END:VCALENDAR";
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.office365.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 'donotreply@xxxxxx.ca';
$mail->Password = 'xxxxxx';
$mail->SetFrom('donotreply@xxxxxx.ca', 'My App');
$mail->addAddress('mygmailaddress@gmail.com', 'ToEmail');
$mail->Ical = $ical_content;
这个问题使我丧命。如果可以的话,将不胜感激!