You are here: using php mail to forward email? « PHP Programming Language « IT news, forums, messages
using php mail to forward email?

Posted by Craig Hurley on 10/14/07 20:54

Hello,

user@x.com receives an email from user@a.com. I want to forward that
email to user@y.com. I want the contents/header to remain intact, with
the exception of adding "X-Forwarded-For". In other words, when
user@y.com received the email, it will be from user@a.com, but will
contain a reference that it was forwarded by user@x.com.

I'm piping all email destined for user@x.com to a php script. I've seen
some very complicated examples of using the mail function and I'm unsure
how to use the mail function to do what I need. I'm relatively new to
php so any advice is appreciated.

Thank you,
Craig.


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

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

// forward it to user@y.com
// ???


?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация