Pear Mail - Recipient address rejected - Error

自作多情 提交于 2019-12-24 05:51:05

问题


I am running into the following error using Pear Mail:

Notice: Error in sending mail: Failed to add recipient: user@domain.com [SMTP: Invalid response code received from server (code: 550, response: 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table)] in /PEAR/PEAR.php on line 873

The email is not sent. Other email addresses such as Gmail and Yahoo are working OK. It only errors for specific email clients, as far as I am aware.

I am using the following script to send the queued mail:

require_once "Mail/Queue.php";

$db_options['type']        = 'mdb2';
$db_options['dsn']         = 'mysql://username:password@localhost/db';
$db_options['mail_table']  = 'mailqueue';
$mail_options['driver']    = 'smtp';
$mail_options['host']      = 'hostAddress';
$mail_options['port']      = 25;
$mail_options['localhost'] = 'localhost'; //optional Mail_smtp parameter
$mail_options['auth']      = false;
$mail_options['username']  = 'user@domain.com';
$mail_options['password']  = 'password'; 

$max_amount_mails = 100;
$mail_queue =& new Mail_Queue($db_options, $mail_options);
$mail_queue->sendMailsInQueue($max_amount_mails);

Does anyone have any ideas why this error would be caused for specific addresses?

I am running PHP5.2/Apache2(CentOS 5.5)/Pear Mail 1.2.0/Pear Mail Queue 1.2.6/

Thank you


回答1:


My goodness, that error message has more padding than error! Let's split it out a bit.

Notice: 
Error in sending mail: 
Failed to add recipient: user@domain.com 
[SMTP: 
Invalid response code received from server 
(code: 550, 
response: 5.1.1 : 
Recipient address rejected: 
User unknown in virtual mailbox table)]

That last line is the only one we care about.

The SMTP server looked up the address you were using and is complaining that the user could not be located. In other words the address is bogus and is being rejected.




回答2:


Somehow that recipient's email is being treated as local mail (e.g. domain.com points at your local server, and the username doesn't exist on your machine. Do a DNS lookup on that recipient's domain and see what their MX settings are:

$ host -t mx domain.com
domain.com mail is handled by 10 someserver.domain.com
$ host someserver.domain.com
someserver.domain.com has address x.x.x.x

Possibly the MX host is a "gag" domain, such as localhost, or where the MX server has an IP of 127.0.0.1, which fools spammers into spamming themselves.



来源:https://stackoverflow.com/questions/5354444/pear-mail-recipient-address-rejected-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!