You may also want to do additional regular expression checks to insure the "Reply-To" address is a valid email. A simple way to do that (no doubt great improvements could be made), is to do the following:
Now we do our decision-making "if" statement. Basically the technique I use to avoid the message loops (which, by the way, can crash a server in no time) is to require the word "unsubscribe" in the subject header. If, for some reason, the message the mailbot sends is returned, the subject will be changed (it would now say something like "Returned Mail"), and the mailbot will not reply. Thus a loop is avoided.