亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么從 phpmailer 發送時發件人會被 postfix 拒絕?

為什么從 phpmailer 發送時發件人會被 postfix 拒絕?

PHP
手掌心 2023-10-22 21:15:20
當我運行以下 PHP 代碼時,出現錯誤。$mail = new PHPMailer;$mail->isSMTP();$mail->SMTPDebug = SMTP::DEBUG_SERVER; // debug$mail->Host = 'localhost';$mail->Port = 25;$mail->SMTPAuth = true;$mail->Username = $uname;$mail->Password = $pw;$mail->CharSet = PHPMailer::CHARSET_UTF8;$mail->setFrom('[email protected]', 'website registration');$mail->addAddress($cleaned_email);$mail->Subject = 'Please verify your account';$msg = '[registration text...]'$msg = wordwrap($msg, 70);$mail->Body = $msg;                        if (!$mail->send()) {  echo $mail->ErrorInfo;  exit();} else {  [... add user to db, etc...]}郵件似乎已發送。PHPMailer 不會生成任何錯誤,并且數據庫代碼會運行。這是在 mail.log 中生成的錯誤。Aug 22 11:47:06 server postfix/smtp[8339]: 079AB1F909: to=<outsider-at-anydomain.com>, relay=mail.brighthouse.com[47.43.26.56]:25, delay=5.7, delays=0.06/0.02/0.31/5.3, dsn=2.0.0, status=sent (250 2.0.0 <user-at-example.com> sender rejected. Please see understanding-email-error-codes for more information.)我嘗試將發送地址更改為我在 PHP 代碼中進行身份驗證的用戶。我嘗試將帶有匹配哈希表的 smtpd_sender_login_maps 參數添加到我的后綴配置中,以將無回復地址映射到我進行身份驗證的用戶,但它會將其作為未使用的參數忽略。后綴配置:# See /usr/share/postfix/main.cf.dist for a commented, more complete version# Debian specific:  Specifying a file name will cause the first# line of that file to be used as the name.  The Debian default# is /etc/mailname.#myorigin = /etc/mailnamesmtpd_banner = $myhostname ESMTP $mail_name (Raspbian)biff = no# appending .domain is the MUA's job.append_dot_mydomain = no# Uncomment the next line to generate "delayed mail" warnings#delay_warning_time = 4hreadme_directory = no# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on# fresh installs.compatibility_level = 2
查看完整描述

2 回答

?
呼喚遠方

TA貢獻1856條經驗 獲得超11個贊

“發件人”地址的語法不正確:

$mail->setFrom('在示例 .com 處無回復', '網站注冊');

您需要使用有效的電子郵件地址,例如:

$mail->setFrom('[email protected]', 'website registration');


查看完整回答
反對 回復 2023-10-22
?
嚕嚕噠

TA貢獻1784條經驗 獲得超7個贊

我的問題與 PHP Mailer 無關。我發布的 php 代碼有效。我的問題是我的電子郵件服務器設置。

查看完整回答
反對 回復 2023-10-22
  • 2 回答
  • 0 關注
  • 191 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號