我需要发送一封带有标准php邮件功能附件的电子邮件。我不能使用像phpmailer这样的类。 PHP verison 5.3。
到目前为止这是有效的。
mail($to,$subject,$content,$headers);
你可以帮帮我吗?
答案 0 :(得分:0)
使用以下代码发送带附件的邮件
$email = new PHPMailer();
$email->From = 'you@example.com';
$email->FromName = 'Your Name';
$email->Subject = 'Message Subject';
$email->Body = $bodytext;
$email->AddAddress( 'destinationaddress@example.com' );
$file_to_attach = 'PATH_OF_YOUR_FILE_HERE';
$email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' );
return $email->Send();