嘿,我正试图从php脚本发送一封电子邮件。当我尝试这样做时,我会得到一个标题为"mailtodisk.exe-无磁盘"的弹出框。在错误消息的正文中,它写道:"驱动器中没有磁盘。请将磁盘插入驱动器''Device''Harddisk1''DR1"。
我试图弄清楚这一点,但无济于事。我在本地主机上执行此操作。
这是我应该发送电子邮件的脚本:
<?php
$to = $_POST['email1'];
$subject = "Test mail";
$message = "I just sent you an email!";
$from = "ULSRL@louisiana.edu";
$headers = "From:" . $from;
if( mail($to, $subject, $message, $headers) )
{
echo ("Mail Sent.");
}
else
{
echo ("Mail could not be sent!");
}
?>
非常感谢您的帮助!感谢:)
我猜您正在使用XAMPP?
如果是这样,您将需要修改XAMPP安装中的php.ini,请查找以下行:
; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
;sendmail_path = "'"C:'xampp'sendmail'sendmail.exe'" -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:'xampp'mailoutput folder
sendmail_path = "C:'mailtodisk'mailtodisk.exe"
邮件无法在PHP中传递,即使SMTP服务器正在运行,并且PHP mail()返回真实的
这也应该有助于:http://blog.joergboesche.de/xampp-sendmail-php-mailversand-fuer-windows-konfigurieren#xampp_180_sendmail
您正在Localhost中尝试此解决方案。所以你可以得到这个错误。尝试现场工作。你一定会成功的。
对于XAMPP,我有相同的消息,它显示了大约4次提供选项
{取消},{重试},}继续}
无论我选择什么,它都回复了4次,而不是显示下一页,而是显示空白页。
我的XAMPP版本将电子邮件保存到C:''xamplep''mailoutput中,这部分工作正常。
我所做的是:我评论出以下行是PHP.ini
;sendmail_path="C:'xampp'mailtodisk'mailtodisk.exe"
现在它不会将文件保存在C:''examplep''mailoutput 中
但它并没有给我这个烦人的错误,下一页加载得很好。
问题的根本原因是mailtodisk.exe
试图访问Windows机器上不存在的驱动器,这导致了此烦人的消息。实际上,这可以被认为是mailtodisk
中的一个错误,所以你可以简单地不使用它,就像这里的其他回复所建议的那样。
此问题通常是由连接到计算机的USB插座引起的,例如用于读取当前为空的SD卡。
如果你喜欢在野外行走,你可以调整你的注册表并取消显示此消息。请在此处查看视频演示https://www.youtube.com/watch?v=Aj7-pLaAq2c