我一直在尋找2天的答案,現在已經找到了這麼多,但仍然無法得到它的工作。管道郵件到php腳本
我有一個cPanel帳戶的WHM服務器。
我創建public_html下下面的PHP腳本在/home/USERNAME/help-system/parse.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新行! –