开发者

Piping emails through cPanel and PHP [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
开发者_如何学Go

This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.

Closed 7 years ago.

Improve this question

I know that there have been quite a few posts floating around on this subject but I am still stuck it seems.

I have set cPanel up so that any emails that go to support@mydomain.com will be picked up and processed by a PHP script.

Now after much battling I have been able to get it to basically forward the email onto another address yet it is still bouncing the original email back to the sender too which seems weird to me. Here is the script that I use:

#!/usr/bin/php -q
<?php

$fd = fopen("php://stdin", "r");

$email = '';

while(!feof($fd))
{
    $email .= fread($fd, 1024);
}

fclose($fd);
mail('reciever@mytest.com', 'test', $email);
?>

And I have also tried to control the issue with output buffering and yes before you ask the script is chmod'd to 755...

Any help really would be appreciated as it is starting to annoy me now.


Most likely it has been malfunctioning email server in your service provider. PHP does spot if there is no mail daemon running and gives appropriate error, but it can’t do any proper error checking about mail actually delivered: after all, it might fail after a day or two and user naturally won’t wait all that time for the script to end.

Postfix updates for example often requires some care as it takes new configuration into use automatically. Or Dovecot has been updated and not restarted and it will refuse to do anything because of that by default.


Does your cPanel not have email forwarding already? (http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/EmailFowarders)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜