我正在使用phpmailer发送电子邮件。但我所有的电子邮件都是用非本人附件发送的。在使用addAttachemnt函数之前,我已经检查了变量是否已设置,并且它们是。它看起来像这样:
$fname = $_FILES['file']['name'];
$fTmpName = $_FILES['file']['tmp_name'];
$mail = new PHPMailer();
$mail->From = "mymail@mymail.com";
$mail->FromName = "mymail.com"; //moje meno
$mail->IsHTML(true);
$mail->IsSMTP();
$mail->Host = "smtp.mymail.com";
$mail->Subject = "Subject";
$mail->AddAddress($email);
echo $fnameZivotopis;
$mail->AddAttachment($fTmpName,$fname);
$mail->Body = $msg;
$mail->Send(); // send message
尝试使用AddStringAttachment(字符串$att_file_data,字符串$attfiles_name,…)。