dotty
dotty

Reputation: 41513

email application help. Send email to made up email address which is redirected to real email

I'm wondering how i would go about making the following application:

Upvotes: 0

Views: 256

Answers (3)

Sabeen Malik
Sabeen Malik

Reputation: 10880

Just pipe all orphan email (specific to that domain) to ur PHP script and use something like this to extract the email content:

$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
    $email .= fread($fd, 1024);
}
fclose($fd);

then extract the "to" field and if it belongs to a user .. forward the email to him.If you have cPanel .. this is even easier. goto mail > default address > set default address and instead of putting an email address there put something like this "|php -q /home/whatever/public_html/pipe.php" .. ofcourse without the quotes

Upvotes: 0

Michael Borgwardt
Michael Borgwardt

Reputation: 346476

You're basically describing a mail transfer agent AKA mail server. So all you need to do is a server to run it on, the required MX DNS records, and an API that allows you to configure forward addresses. Look through the documentation of the servers listed here to see which ones offer the latter.

Upvotes: 0

user187291
user187291

Reputation: 53950

The simplest option is to tell your smtp server to forward all ingoing mails to an external program (your php script). For example, for qmail this will be like | php myphpscript.php in .qmail file. Your script will read email from stdin and resend it to the real address.

Upvotes: 1

Related Questions