Linux 服务器(php 邮件)发送附件 Windows IIS(php 邮件)不会(否则邮件工作完美)
我有一个脚本(就业申请表),用于发送带有文件附件的 html 电子邮件。它是在Linux服务器上测试和开发的,但正在Windows iis7上部署。问题在于,通过 php 邮件 (smtp) 发送的文件附件显然被删除了所有数据。文件到达时带有扩展名和文件名,但文件大小现在为 304 字节或 260 字节。可能是什么原因造成的以及我该如何解决。
I have a script (employment application form) that sends an html email with file attachments. It was tested and developed on a linux server but is being deployed on windows iis7. The problem, is that the file attachments being sent through php mail (smtp) are apparently being stripped of all their data. The files arrive with the ext and file name, but the files size is now 304 bytes or 260 bytes. What could be causing this and how can I resolve.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PHP 实际上本身并不发送邮件。对
mail
的调用只是到系统邮件程序的传递。您使用 sendmail 或类似的东西在 Linux 机器上进行了测试,但 Windows 邮件程序有所不同。在确切的环境上进行测试,您将能够进行调试。PHP actually doesn't send mail itself. The call to
mail
is just a pass through to the system mailer. You tested on a linux machine using sendmail or something similar but windows mailers are different. Test on the exact environment and you will be able to debug.事实证明,C:\windows\temp 没有具有读写访问权限的 IIS_IUSRS。
因此,如果您遇到此问题:
* 这是在 php.ini 中设置的,这是 Windows 下临时文件的默认设置,您的 php.ini 文件可能有所不同,因此请仔细检查以确定。
您现在应该可以走了。我希望我的回答可以帮助其他人。
It turns out that C:\windows\temp did not have IIS_IUSRS with read and write access.
So if you run into this problem:
* this is set in php.ini, this is the default setting for temporary files under windows, your php.ini file might be something different, so double check to be sure.
You should now be good to go. I hope that my answer can help someone else down the road.