• I have made progress in generating non-NULL HTML.

    I have found that by commenting out the following three IF blocks, I get non-NULL HTML and there is something to look at in the resulting email:

    IF EXISTS .... #REPLINFO

    IF EXISTS .... #PUBINFO

    IF EXISTS .... #REPLSUB

    I'm not sure yet why these are problematic, and why the HTML becomes NULL if they are allowed to run. I'm sure it has to do with the COALESCE as someone pointed out.

    I would appreciate any thoughts, but at least this is useful already.