XF 2.2 "503 5.5.1 Error: nested MAIL command" and "554 5.5.1 Error: no valid recipients" / local smtp

ehd

Well-known member
Hi, similar to this one: https://xenforo.com/community/threads/503-5-5-1-error-nested-mail-command-from-smtp-server.166213/ I keep getting this daily since the upgrade to 2.2 running the latest version.
The email-addresses (which I changed to example.com) seem to be all right.

What could cause this? Running no external mail-services.

Thanks alot!



Swift_TransportException: Email to xxx@example.com failed: Expected response code 250 but got code "503", with message "503 5.5.1 Error: nested MAIL command " src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457

Stack-Trace
#0 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->assertResponseCode('503 5.5.1 Error...', Array)
#1 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('MAIL FROM:<boun...', Array, Array, false, NULL)
#2 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(390): Swift_Transport_EsmtpTransport->executeCommand('DATA
', Array, Array)
#3 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(497): Swift_Transport_AbstractSmtpTransport->doDataCommand(Array)
#4 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(516): Swift_Transport_AbstractSmtpTransport->doMailTransaction(Object(Swift_Message), 'bounce@xxx', Array, Array)
#5 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo(Object(Swift_Message), 'bounce@xxx', Array, Array)
#6 src/XF/Mail/Mailer.php(304): Swift_Transport_AbstractSmtpTransport->send(Object(Swift_Message), Array)
#7 src/XF/Mail/Queue.php(138): XF\Mail\Mailer->send(Object(Swift_Message), Object(Swift_SmtpTransport), Array)
#8 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(G)
#9 src/XF/Job/Manager.php(258): XF\Job\MailQueue->run(G)
#10 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, G)
#11 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, G)
#12 job.php(43): XF\Job\Manager->runQueue(false, 8)
#13 {main}

Status

array(4) {
["url"] => string(14) "/forum/job.php"
["referrer"] => string(83) "https://www.example.com/forum/threads/thread-title.12345678/page-3"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}





and




Swift_TransportException: Email to xxx@example.com failed: Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients " src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457


Stack-Trace
#0 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->assertResponseCode('554 5.5.1 Error...', Array)
#1 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('DATA
', Array, Array, false, NULL)
#2 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(390): Swift_Transport_EsmtpTransport->executeCommand('DATA
', Array, Array)
#3 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(497): Swift_Transport_AbstractSmtpTransport->doDataCommand(Array)
#4 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(516): Swift_Transport_AbstractSmtpTransport->doMailTransaction(Object(Swift_Message), 'bounce@example.com', Array, Array)
#5 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo(Object(Swift_Message), 'bounce@example.com', Array, Array)
#6 src/XF/Mail/Mailer.php(304): Swift_Transport_AbstractSmtpTransport->send(Object(Swift_Message), Array)
#7 src/XF/Mail/Queue.php(138): XF\Mail\Mailer->send(Object(Swift_Message), Object(Swift_SmtpTransport), Array)
#8 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(G)
#9 src/XF/Job/Manager.php(258): XF\Job\MailQueue->run(G)
#10 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, G)
#11 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, G)
#12 job.php(43): XF\Job\Manager->runQueue(false, 8)
#13 {main}

Status
array(4) {
["url"] => string(14) "/forum/job.php"
["referrer"] => string(68) "https://www.example.com/forum/whats-new/posts/3230752/page-2"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
As it stands, ignore it unless it's happening quite a lot. I'm not clear if this is a bug in the mail sending library we use with the specific response of your SMTP server.

If you are getting it regularly, please let us know.
 
same issue in my server, it's happening quite a lot.
Email address is verified and emails are received....

Swift_TransportException: Email to x@tld.com failed: Expected response code 250 but got code "554", with message "554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-2: perfvToowholew <x@tld.com " src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457
Generated by: Unknown account 7 April 2021 at 12:19
Stack trace
#0 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->assertResponseCode('554 Message rej...', Array)
#1 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('
.
', Array, Array, false, NULL)
#2 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(404): Swift_Transport_EsmtpTransport->executeCommand('
.
', Array)
#3 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(500): Swift_Transport_AbstractSmtpTransport->streamMessage(Object(Swift_Message))
#4 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(516): Swift_Transport_AbstractSmtpTransport->doMailTransaction(Object(Swift_Message), 'no-replay@mail....', Array, Array)
#5 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo(Object(Swift_Message), 'no-replay@mail....', Array, Array)
#6 src/XF/Mail/Mailer.php(304): Swift_Transport_AbstractSmtpTransport->send(Object(Swift_Message), Array)
#7 src/XF/Mail/Queue.php(138): XF\Mail\Mailer->send(Object(Swift_Message), Object(Swift_SmtpTransport), Array)
#8 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(7.99999)
#9 src/XF/Job/Manager.php(258): XF\Job\MailQueue->run(7.99999)
#10 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, 7.99999)
#11 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, 7.99999)
#12 job.php(43): XF\Job\Manager->runQueue(false, 8)
#13 {main}
Request state
array(4) {
["url"] => string(8) "/job.php"
["referrer"] => string(50) "https://domain/admin.php?tools/rebuild"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
Getting this roughly a dozen times each day too.

The underlying reason seems to be that mail is sent to a non-existant domain, which the mail server responds to with "554 5.5.1 Error: no valid recipients" at this point something breaks with the mailer connection, yet swiftmailer keeps trying to send more email.
 
A potential workaround is discussed here: https://xenforo.com/community/threads/errorexception-during-email-sending.193045/

2.2.5 will include a fix for this. Note that it only happens in the situation where an error has occurred. We don't really expect the SMTP server to reject an email to a domain it can't resolve (though I'm aware this is a setting of some servers); if that happens, you might need to deal with these errors manually for example, as they wouldn't handle the bounce framework.
 
Back
Top Bottom