This isn't really a problem with sendmail but with your understanding of the shell's heredoc syntax. you should probably read up a little on that.
A hint: any sendmail compatible MTA expects the WHOLE mail on stdin when called the way you do it. So you could do something like that:
# cat - | sendmail -t -i
This is the mail body.
When using heredoc to provide the input to sendmail, all this input has to be given LITERALLY before the end marker of the heredoc ... the ">" prompt indicates that the shell expects more input as the command is not complete yet.