Normally I would use /var/qmail/control/smtproutes but I don't see how that can work with qpsmtpd.
If the answers you have gotten already haven't confused you, let me try. ;)
smtproutes works just fine with qpsmtpd, which is really just a programmable replacement for qmail's own smtpd. Once a message is queued, then qmail determines whether it should be handled by qmail-local or qmail-remote and you can use smtproutes to force mail to be delivered to a specific server. I do this for a couple of domains and it works fine. If the remote server is down, the mail is deferred and retried on the normal schedule.
Another issue is that i'm using check_delivery and if mailboxes for the domain don't exist locally, my mail server will reject them.
This is the real issue, then. You need to have a way to check remote MTA's for mailboxes. If you don't control the remote servers as well, one way to do this is to simply accept all mail for those domains and just let the remote server handle the bounces. I do this for two domains right now and it's acceptable for small domains without much spam. This method requires a very slightly modified check_delivery.
However, if you do control the remote MTA's, you can do better by providing qpsmtpd with a way to check for the existance of a mailbox in that domain. I've done this two different ways now:
1) set up the remote MTA to support VRFY (from your relay host only); I actually wrote a qpsmtpd plugin to do this (only permits VRFY commands for IP addresses listed in a config file); then add a RCPT plugin to your relay qpsmtpd server to VRFY the address before accepting the message (oddly enough, I have a plugin to do this too).
2) use some out of band method to query the remote server for valid mailboxes; I wrote a small finger server which queries my central vpopmail MySQL database to validate the mailboxes; this is a much lighter weight check (and you have to remember to check aliases and list addresses, too).
In either case, I have structured my plugins to accept _all_ mail for the domains in question if the remote machine is unreachable for some reason. This way, if I have to later bounce forged address occasionally, that is an acceptable cost, so that there is no chance I will lose legitimate messages.
HTH
John
