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
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.
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.
精彩评论