ニュースレターの送信にサードパーティの SMTP サービスを使用しています。そのため、私の ISP はバウンスを受け入れません。なぜなら、バウンスは彼らから発信されたものではない電子メールから来ているからです。わかった。そこで、バウンスを受け入れるように、SMTP サービスを使用してメールボックスをセットアップしました。
しかし、私のメーリング リスト プログラムは、return-path が from フィールドとは異なるドメインを持つ電子メールの送信を拒否しています。
これは、メール送信ルーチンの phpmailer が原因だと思います。
キーコードはこれのように見えますが、私はPHPが行っているチェックを回避する方法を理解するほどPHPの専門家ではありません。これは、そのsafe_modeと関係があると思います。使用したい return-path 値は、変数 $this->Sender にあります。
/**
* Sends mail using the PHP mail() function.
* @param string $header The message headers
* @param string $body The message body
* @access protected
* @return bool
*/
protected function MailSend($header, $body) {
$toArr = array();
foreach($this->to as $t) {
$toArr[] = $this->AddrFormat($t);
}
$to = implode(', ', $toArr);
$params = sprintf("-oi -f %s", $this->Sender);
if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
$old_from = ini_get('sendmail_from');
ini_set('sendmail_from', $this->Sender);
if ($this->SingleTo === true && count($toArr) > 1) {
foreach ($toArr as $key => $val) {
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
// implement call back function if it exists
$isSent = ($rt == 1) ? 1 : 0;
$this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$ body);
}
} else {
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
// implement call back function if it exists
$isSent = ($rt == 1) ? 1 : 0;
$this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$b ody);
}
} else {
if ($this->SingleTo === true && count($toArr) > 1) {
foreach ($toArr as $key => $val) {
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
// implement call back function if it exists
$isSent = ($rt == 1) ? 1 : 0;
$this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$ body);
}
} else {
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
// implement call back function if it exists
$isSent = ($rt == 1) ? 1 : 0;
$this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$b ody);
}
}
if (isset($old_from)) {
ini_set('sendmail_from', $old_from);
}
if(!$rt) {
throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
}
return true;
}
このコードの何がリターンパスに別のドメインを使用することを妨げているのか、またはさらに良いことに、これを修正 (またはハッキング) してメールを送信する方法を知っている人はいますか?