dsedug8644 2014-12-11 12:15
浏览 259
已采纳

用PHP管道电子邮件

I would like to pipe email through a PHP script.

To be recognized has a script to be execute by Shell, I've put that line a the begining of my file: #!/usr/bin/php -q

I've enabled PHP's Mail Parse extension.

I have 2 issues:

  1. If I move my script into a sub directory, any email can't be piped, despite of the new valid patch set in my c-panel (Seems like PHP IO stream can't be read in sub directories?). Otherwise, I can pipe email in /public_html (where my php.ini file is), but I'm still unable to call a Mail Parse's function that directory.

  2. My script seems to use another php.ini file, because when I call a function from Mail Parse, PHP warns me that the function is undefined (if I use another script manually, in the same directory and same code, all works and there's no warning.). I've put that line to use a specific php.ini file #!/usr/bin/php -c /homeXX/XXXX/public_html/php.ini. It didn't worked.

Thanks for any answer, it'll be very appreciated.

  • 写回答

2条回答 默认 最新

  • doujiacai4986 2014-12-15 19:13
    关注

    UPDATE: Depending of server configuration, you have to avoid space between command line option (-c) and path (/path/to/script). That solution worked in my case!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?