cat will iterate through its arguments and write their contents to stdout.
In your example, its arguments were "-" and "filename".
cat understands "-" to represent its own stdin. "cat -" will read content from its stdin and write it to its stdout until there is no more data available from stdin.
So in your example, cat first reads content from stdin, and writes it to stdout, then reads content from "filename", and writes it to stdout.
"<< Here" is a bashism for reading text from the following lines up to "Here" (alone on its own line) and writing it to the stdin of the command to its left (in this case the cat command).
Open the bash man page and skip to the "Here Documents" section to read more about this feature:
As for why sendemail vs mailx, I would assume it is used so the email's headers could be given to it via stdin, but I'm not sure.