使用php邮件转发电子邮件? [英] using php mail to forward email?

查看:106
本文介绍了使用php邮件转发电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

us**@x.com 收到来自我们** @ a.com 。我想将这封

电子邮件转发给 us**@y.com 。我希望内容/标题保持不变,

除了添加X-Forwarded-For之外。换句话说,当 us**@y.com 收到电子邮件时,它将来自我们** @ a.com ,但是

包含一个由我们** @ x.com


我正在发送所有发往 us ** @ x.com 到php脚本。我看过

使用邮件功能的一些非常复杂的例子我不确定

如何使用邮件功能来做我需要的事情。我是相对较新的

php所以任何建议都表示赞赏。


谢谢你,

Craig。

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

<?php


//从stdin收到电子邮件

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

$ email ="" ;;

while (!feof($ fd)){

$ email。= fread($ fd,1024);

}

fclose($ fd );


//将其转发给 us**@y.com

// ???

?>

Hello,

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

I''m piping all email destined for us**@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 us**@y.com
// ???
?>

推荐答案

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


email ="" ;;

while(!feof(
email = "";
while (!feof(


fd)){
fd)) {


这篇关于使用php邮件转发电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆