【问题标题】:Piping email to php script将电子邮件传送到 php 脚本
【发布时间】:2013-02-07 17:38:33
【问题描述】:

我已经搜索了 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 设置?我在上面做了什么愚蠢的事情吗?

任何帮助将不胜感激。

干杯。

【问题讨论】:

  • 我可能已经找到答案了!在 cPanel 编辑器中编辑 php 文件并删除 hashbang (shebang) 后的换行符,然后重新放入。这摆脱了 windows 新行并添加了 unix 新行!

标签: php email permissions cpanel whm


【解决方案1】:

Email Piping,好像看不懂windows换行!

所以:

  1. 创建 php 脚本
  2. 在脚本顶部添加 hashbang
  3. 上传
  4. 在 cPanel 中打开 -> 文件管理器 -> 代码编辑器
  5. 删除 hashbang 后的换行符并重新添加
  6. 保存

一切正常

【讨论】:

  • 谢谢!我不知道 windows 新行和 unix 新行之间的区别会以这种方式毁掉某人的一天:(
猜你喜欢
  • 2011-06-14
  • 1970-01-01
  • 2011-09-16
  • 1970-01-01
  • 2012-09-12
  • 1970-01-01
  • 2011-04-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多