Add code page only when appropriate

This involves some repetitive code, so I will likely come back to this.
Add HTML email sender
Using new email sender
Didn't like this...