well, I'm pretty sure I know our code fairly well, and the cdosys section of our inc_mail does not in fact look like the code you posted above, which is why I asked.
however, could you explain exactly at what point you get the error, are you able to send emails to other forum members ? do people recieve registration emails ?