下記の通り届いたメールをPostfixで下記phpファイルに転送し
処理をしてからsendmailに書き込み、複数のメールアドレスに転送されて
一括で複数のブログに投稿するシステムを構築しています。
メールAに送信 → phpに転送(Postfix) → PHPでメールBとメールCに転送(sendmailに書き込む)
この場合、転送されたメールのヘッダーを見ると
Return-PathがメールAになってしまいます。
メールBやメールCとすることは可能でしょうか?
tensou.php
<?php header('Content-Type: text/html; charset=UTF-8'); require_once(dirname(__FILE__).'/../PEAR/Mail/mimeDecode.php'); require_once(dirname(__FILE__)."/phpmailer/PHPMailerAutoload.php"); mb_language("japanese"); mb_internal_encoding("UTF-8"); $input = file_get_contents("php://stdin"); // 標準入力 $decoder = new Mail_mimeDecode($input); $mail_data = $decoder->decode($params); $mail=$mail_data->headers['from']; $mail = addslashes($mail); $mail = str_replace('"','',$mail); //署名付きの場合の処理を追加 preg_match("/<.*>/",$mail,$str); if($str[0]!=""){ $str=substr($str[0],1,strlen($str[0])-2); $mail = $str; } $mail_to=$mail_data->headers['to']; $mail_to = addslashes($mail_to); $mail_to = str_replace('"','',$mail_to); //署名付きの場合の処理を追加 preg_match("/<.*>/",$mail_to,$str); if($str[0]!=""){ $str=substr($str[0],1,strlen($str[0])-2); $mail_to = $str; } $user_mail=array('b@mail.com','c@mail.com'); if($user_mail){ foreach($user_mail as $row){ $sendmail = popen("/usr/sbin/sendmail ".$row['mail'], "w"); $input2=str_replace($mail_to,$row['mail'],$input); fwrite($sendmail, $input2); fclose($sendmail); } } ?>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/02 08:11
2017/10/02 08:16
2017/10/02 10:12
2017/10/02 10:18
2017/10/02 13:13 編集
2017/10/02 14:33
2017/10/02 14:36