Simple way to send mail from Docker container?
Solution 1:
As Jason already mentioned, I think it is indeed cleaner to separate your MTA and backup container.
I ran into this problem some time ago (although I tried to send mail from PHP instead of bash), and I discovered the exim-sender container, which is basically a simple container that acts as an outgoing SMTP server.
Why not link your backup container to such an SMTP container? If you then use ssmtp, you can send mails through the SMTP container. Or you can just use another (external) SMTP server if you prefer.
Solution 2:
Consider sending an email from something like Amazon SES or MailGun or any other HTTP-based mail API rather than adding an entire MTA to your container.
Or make an API call to a alerting system such as OpsGenie or PagerDuty for it.