저는 이것을 집중적으로 연구했습니다. 여기, 스택 오버플로에서, 나는 사람이 전달할 수없는 메일을 되찾기 원한다면 PHP 메일() 함수와 함께 -f 매개 변수를 사용해야한다는 것을 알아 냈습니다. 다음은 내 스크립트입니다 (현재 그대로).PHP 메일() -f 매개 변수가 작동하지 않습니다.
//Send Confirmation email. Following are the variables for the email
// mail function best practices: http://collaborate.extension.org/wiki/Best_Practices_Using_the_PHP_mail_Function
$sendto = $email; // this is the email address collected from the foreach routine.
$e_subject = stripslashes($subject); // Subject
//$message = "<html>" . stripslashes($body) . "</html>";
$message = "
<html>
<body>
<p>Hello " . stripslashes($fName) . ":</p>
<div>" . stripslashes($body) . "</div>
</body>
</html>
";
// Always set content-type when sending HTML email
$header = "MIME-Version: 1.0" . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";;
// extract user domain so you can set up X-Mailer
$u_domain=substr(strrchr($user_email, '@'), 1);
$dom_array = explode(".",$u_domain);
$user_domain = $dom_array[0];
$header .= "X-Mailer: ". $user_domain ."\r\n";
$header .= "X-Sender-IP: {$_SERVER['REMOTE_ADDR']}\r\n";
$header .= "X-Originating-IP: [".getenv("REMOTE_ADDR")."]\r\n";
$header .= "From: " . $user_email . "\r\n";
$header .= "Sender: ". $user_email . "\r\n";
// The "envelope sender" is the address listed in the "Return-Path:" header - and controls where the email is sent to in the event that a recipient address bounces. http://collaborate.extension.org/wiki/Best_Practices_Using_the_PHP_mail_Function
$header .= "Return-Path:" . $user_email . "\r\n";
$header .= "Reply-To:" . $user_email . "\r\n";
$bounceTo = "-f". $user_email;
// Collect variables from above and insert into the mail() function.
mail($sendto, $e_subject, $message, $header,$bounceTo);
많은 메모가 있음을 알게 될 것입니다. 내 메일()이 멋지게 보낸다. 메일을받은 편지함으로 포맷팅해야합니다. 그러나 ... $ bounceTo 변수 ("-f". $ user_email)가 작동하지 않습니다. 3 개의 비활성 주소로 의도적으로 메일을 보냈습니다. 반송 오류가 발생하지 않았습니다.
위의 코드의 모든 헤더 설정은 바운스 백에 영향을 줄 수 있음을 알았 기 때문에 나타납니다. 불필요한 헤더를 없애고 필요한 것을 추가하고자합니다. 그러나 ...이 시점에서 스크립트는 뒤죽박죽 인 것처럼 보입니다. 바운스 백을 생성하지 않습니다.
모든 의견을 환영합니다.
감사합니다 많은 :
파빌리온
http://www.php.net/manual/en/function.mail.php#94170의 도움말도 도움이 될 수 있습니다. – jg314
예 - 게시하기 전에 해당 게시물을 검토했습니다. 모든 반송은 보낸 사람과 동일한 반송 경로 여야하므로 해당 게시물의 제안은 적용되지 않습니다. – Pavilion