管理电子邮件到PHP脚本

时间:2013-02-07 17:38:33

标签: php email permissions cpanel whm

我一直在寻找2天的答案而且已经找到了这么多,但仍然无法让它发挥作用。

我有一个带有cPanel帐号的WHM服务器。

我在/home/USERNAME/help-system/parse.php的public_html下创建了以下php脚本进行测试:

#!/usr/local/bin/php -q
<?php
mail('****@davidslack.co.uk', 'Test email', 'Test email to get an email into the script');
?>

我还在cPanel中创建了一个转发到:

的转发器
|/home/USERNAME/help-system/parse.php

php脚本和目录具有权限0755(也尝试过0777)

现在,当我向正确的地址发送电子邮件时,我会收到一封反弹电子邮件,如:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

  pipe to |/home/USERNAME/help-system/parse.php
    generated by *********@davidslack.co.uk
    local delivery failed

The following text was generated during the delivery attempt:

------ pipe to |/home/USERNAME/help-system/parse.php
       generated by *********@davidslack.co.uk ------

Extension '/home/USERNAME/help-system/parse.php' not present.

------ This is a copy of the message, including all the headers. ------

我错过了什么?是否有WHM或cPanel设置我还没有启用?我上面做过一些蠢事吗?

非常感谢任何帮助。

干杯。

1 个答案:

答案 0 :(得分:4)

电子邮件管道,看起来无法理解windows换行符!

所以:

  1. 创建php脚本
  2. 将hashbang添加到脚本顶部
  3. 上传
  4. 在cPanel中打开 - &gt;文件管理器 - &gt;代码编辑器
  5. 删除hashbang后的换行符并将其添加回
  6. 保存
  7. 现在全部工作

相关问题