After check_mail
returns, the per_recip_data of $msginfo
will be filled in with instructions for MTAs capable of handling per-recipient destinies. Note that the order of elements of this array is preserved, which may assist processing. Each element has the following useful properties:
This is set to 1 if the message has been bounced by check_mail
or marked for discard or rejection, and to 2 if the message has been forwarded (in these cases the MTA should be told to drop the recipient). It is left undefined if the MTA should be left to forward the message for this recipient.
Per-recipient SMTP response
The original recipient address - useful for comparing to recip_final_addr
The final recipient address, after any necessary modifications have been applied
You may also wish to consult the $msginfo->dsn_sent property. This is set to 1 if check_mail
has sent a DSN and 2 if it has pretended to send one. In these cases, the mail should be discarded for any recipients with a 5xx response code to prevent the MTA sending another DSN.
If your MTA can handle per-recipient SMTP responses, then you should simply use the recip_smtp_response properties in combination with $msginfo->dsn_sent.
If it can handle per-recipient discards but not per-recipient responses, then you should simply use the global SMTP response if it is not 2xx. If it is 2xx, then you should instruct the MTA to drop recipients who have recip_done non-zero, and (if possible) to change any non-done recipients for whom recip_final_addr is not equal to recip_addr.