管理电子邮件到php脚本 [英] Piping email to php script

查看:157
本文介绍了管理电子邮件到php脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找两天的答案,发现这么多,但仍然无法让这个工作。

I've been searching for an answer for 2 days now and have found so much, but still can't get this to work.

我有一个WHM服务器与cPanel帐户。

I have a WHM server with a cPanel account.

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

I have created the following php script under public_html at /home/USERNAME/help-system/parse.php for testing:

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

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

I have also created a forwarder in cPanel that forwards to:

|/home/USERNAME/help-system/parse.php

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

The php script and directory have permissions 0755 (also tried 0777)

现在,当我发送电子邮件到正确的地址时,我得到一个反弹回复电子邮件,如:

Now, when I send an email to the correct address I get a bounce back email like:

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设置?有没有上述的愚蠢?

What have I missed? Is there a WHM or cPanel setting I haven't enabled? Have I done something stupid with the above?

任何帮助将不胜感激。

干杯。 p>

Cheers.

推荐答案

电子邮件管道,看起来似乎无法理解Windows的换行符

Email Piping, looks like it can't understand the windows newline!

so:


  1. 创建php脚本

  2. 将hashbang添加到脚本的顶部

  3. 上传

  4. 在cPanel中打开 - >文件管理器 - >代码编辑器

  5. 在hashbang之后删除换行符,添加回

  6. 保存

  1. Create php script
  2. Add hashbang to the top of the script
  3. Upload
  4. Open in cPanel -> File manager -> Code editor
  5. Delete the newline after the hashbang and add it back in
  6. Save

现在全部工作

这篇关于管理电子邮件到php脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆