1
我用代码来发送电子邮件:简单的脚本发送电子邮件?
<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
但我得到:
的sendmail:致命的:CHDIR /库/服务器/邮件/数据/阀芯:没有这样的文件或目录
我不知道如何添加附件,重要的是我需要指定Content-Type的附件,任何人都可以帮助我吗?
谢谢!
您使用的是Linux还是OSX? – mittmemo 2012-08-17 03:40:36
您的服务器(Mac?)配置错误,您必须先解决该问题,然后才能发送邮件。然后使用PHPmailer或Swiftmailer查看电子邮件 - 使用mail()发送附件非常痛苦且容易出错。 – 2012-08-17 03:46:19
@MarcB它绝对是一个有趣的体验,处理附件和各种mime组合自己虽然;-) – 2012-08-17 04:04:06