Server issue Email to [address] failed: Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients "

bottiger

Active member
Affected version
2.2
[email removed] appears to be a mistyped email address ending in .comd instead of .com.

Code:
Swift_TransportException: Email to [email removed] 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:459

#0 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(344): 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(392): Swift_Transport_EsmtpTransport->executeCommand('DATA
', Array, Array)
#3 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(499): Swift_Transport_AbstractSmtpTransport->doDataCommand(Array)
#4 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(518): Swift_Transport_AbstractSmtpTransport->doMailTransaction(Object(Swift_Message), 'bounce+452dfdb3...', Array, Array)
#5 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo(Object(Swift_Message), 'bounce+452dfdb3...', 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(XF\Mail\SmtpTransport), Array)
#8 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(8)
#9 src/XF/Job/Manager.php(258): XF\Job\MailQueue->run(8)
#10 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, 8)
#11 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, 8)
#12 job.php(43): XF\Job\Manager->runQueue(false, 8)
#13 {main}
 
This is manifesting slightly differently, but I suspect this is the the same sort of issue that was discussed here:


If the SMTP server is rejecting the mail because the DNS doesn't resolve, that isn't exactly expected by our code and isn't really something we can programmatically detect. This may be a reasonable use case for situations where a user is interactively sending mail (via something like Thunderbird), but it isn't really a great approach for a progammatic/API-style interaction with the SMTP server.

The standard approach is for the SMTP server to accept the mail and queue it if it can't delivery, eventually falling back to a failure after a period of time (which it then returns as a bounce).

What MTA/SMTP server are you using to confirm? (And if it's a local server, can you use the PHP built-in style approach?)
 
I'm using postfix + dovecot.

It appears that the user mistyped his email 2 times, and fixed it within 1 minute, however I'm still getting error messages about his mistyped emails even today.
 
Last edited:
Note that a failure like this will queue the mail and we will retry it over a period of time until enough attempts and we give up.

I'm guessing this is related to the Postfix reject_unknown_recipient_domain option, though I'm not positive. Ultimately, this isn't really something we can detect and action on as it's not easily discernable from a mail server issue. If XF is the primary use of this SMTP server, I'd probably disable that setting and allow Postfix's queue to handle it (which will bounce if the issue continues over time).
 
Note that a failure like this will queue the mail and we will retry it over a period of time until enough attempts and we give up.

I'm guessing this is related to the Postfix reject_unknown_recipient_domain option, though I'm not positive. Ultimately, this isn't really something we can detect and action on as it's not easily discernable from a mail server issue. If XF is the primary use of this SMTP server, I'd probably disable that setting and allow Postfix's queue to handle it (which will bounce if the issue continues over time).

I still seem to be getting these errors and I don't have that option in my config. I'm basically using a stock install of postfix and I'm sure others are too.

Are you not able to catch the error and consider the email to be bounced?
 
Back
Top Bottom