Is it possible to hold rejected messages in a queue?
If you OK with defer_if_reject
solution then you can add this rule on smtpd_recipient_restriction
defer_if_reject reject_unlisted_recipient
For more info checks the official documentation
For HOLD solution, you can search postgresql query to return value HOLD if account doesn't exist in table. Quick googling reveals that Postgre have feature WHERE NOT EXISTS
(check this page for some examples). (Sorry I don't familiar with Postgre :))
So, in smtpd_recipient_restriction define
check_recipient_access pgsql:/path/to/pgsql/config
For the content of /path/to/pgsql/config
, please consult this man page