我正在使用第三方SMTP服务发送我的时事通讯。正因为如此,我的ISP不接受反弹,因为他们是来自一个电子邮件不与他们的起源。好吧。所以我用我的SMTP服务设置了一个邮箱来接受反弹。
但是,我的邮件列表程序拒绝发送返回路径与发件人字段不同的域的电子邮件。
我认为这是由phpmailer在它的mailsend例程中引起的:
关键代码似乎是这样的,但我不是PHP专家,不知道如何绕过它正在做的任何检查,我认为这与safe_mode有关。我想使用的返回路径值在变量中:$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;
}
有没有人知道在这段代码是什么阻止我使用不同的域为我的返回路径,或者更好的是,有人知道我如何可以修复(或黑客)这,所以它会发送我的邮件?
@Sanmai的评论让我看了看参数。当我开始在phpmailer例程中测试其中一些时,我发现代码没有执行。所以至少他让我意识到问题出在别的地方。
我仍然有这个问题。我现在试着更好地分离它。那么也许我能解出来,如果解不出来,我就修改这道题再试一次。
谢谢你给了我一些东西。
你得到什么错误?这可能是您正在使用的邮件服务器不允许不同的返回地址域,以防止他们的服务被用来发送垃圾邮件。