The following command (using the one and only original sendmail) sends an email:
echo "Subject: Testing Email" | cat - body.txt \
| /usr/lib/sendmail -v -F some@body.com -t some@body.else.com
WordPress and others use it in a similiar fashion.
Invoking it like that from within a docker container gets stuck, even though DNS (for MX lookup) and the MTA are reachable and the container is running privileged. People come up with all kinds of workarounds like using ssmtp which involve the setup of a dedicated MTA for the container. Given DNS and MX are available, I do not see a necessity for a dedicated MTA.
Why does the (one and only original) sendmail executable fail to send emails from within docker containers?