One would think this is a dead simple thing, but apparently it isn't—or I just really suck at it.
Context: I have a little home server hosting things like task-managers (TaskWarrior), my website, my IRC bouncer, etc. I try to keep this server as secure as possible. Also, I would like to keep it well-maintained.
I thought it would be nice to receive some periodic/event-triggered emails from this server to detect possible security breaches, failed services and other problems. The actual implementation is irrelevant, I'd either just send myself the outputs of periodic maintenance scripts or perhaps grep some keywords out of logfiles.
The problem is that I am stuck at simply sending an email to my address. What I tried:
- I need an SMTP server to send the email, so I should just use my email service provider's, I guess (mailbox.org). This is how it turned out:
$ openssl s_client -connect smtp.mailbox.org:465 [...] --- 220 smtp2.mailbox.org ESMTP Postfix HELO myhostname 250 smtp2.mailbox.org MAIL FROM: me@myhostname 250 2.1.0 Ok RCPT TO: email@example.com 554 5.7.1 <my-ip:30920>: Client host rejected: Access denied
I am not sure if this has to do with having to authenticate on the server. I tried with
smtp.gmail.com as well, but I got an
530-5.5.1 Authentication Required reply to my
MAIL FROM there. However, I would rather like to avoid Google anyway.
Supposing the failure is due to having to authenticate, I face another problem: sure, I could just tell my MTA (let's say
msmtp) my password for my mailbox.org account, it doesn't sound like a good idea. I am not experienced enough in setting up security to be certain my server won't be hacked easily. I know that once root access is gained I am done for, but I could still mitigate the damage by I don't know, not having my plaintext passwords scattered around the server? Normally, I keep them GPG-encrypted using
Perhaps I should run my own SMTP server? I can't use my domain for that though, since I have set up mailbox.org with emails of my own domains, so my MX DNS records point to their servers. I don't really want to buy another domain just for this...
Summary & TL;DR
Is there some way to simply send emails to my own address provided by mailbox.org from my server without
- running and maintaining a complex SMTP server on my server
- having to expose sensitive information such as my passphrase on the server to log into the provider's SMTP server?