this post was submitted on 31 Oct 2023
9 points (100.0% liked)

Self Hosted - Self-hosting your services.

11399 readers
3 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules

Important

Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!

Cross-posting

If you see a rule-breaker please DM the mods!

founded 3 years ago
MODERATORS
 

Hi,

I'm looking for some way to send my own alerts via e-mail in some way. Whenever I try to search for this, most docker images have a much grander goal, and I have a hard time understanding how to use them for my purpose.

What would I want? It'd be nice to have a docker running some smpt-server (I suppose), so that I can make my own python script that scrapes a website, looks at some metric, and e-mails me whenever whatever I'm looking for is found. I only want it to be available on and to receive mails from localhost, no dns, just forward e-mails to my personal one, no web-interface, etc.

I'm quite new to self-hosting, but I hope you still understand what I'm looking for. Is it possible? Should I look for another solution? Will this not work? Any help/input very much welcome.

top 16 comments
sorted by: hot top controversial new old
[–] treesoid@lemmy.world 4 points 1 year ago

Check out ntify, it might fit your use case

[–] Kit@lemmy.blahaj.zone 4 points 1 year ago (2 children)

You don't need an SMTP server if you just want to send mail out outbound. Just use mailx.

[–] Illecors@lemmy.cafe 3 points 1 year ago (1 children)

This is the way, @mumblefish. I use mail from mailutils:

mail "$recipient" \
          -r "$emailFrom" \
          -s "$emailSubject" \
          < "$filename"

where $filename is a file containing the body content of the email.

[–] mumblerfish@lemmy.world 1 points 1 year ago* (last edited 1 year ago) (1 children)

I wanted to try this first, I can see lemmy parsed a less-than into "<", which I replaced. But I'm getting no e-mails to the $recipient address. I set $emailFrom to a completely fake one, and another time as my personal, same as $recipient, address, but I'm not receiving any e-mails.

[–] Kit@lemmy.blahaj.zone 2 points 1 year ago (1 children)

It's definitely going to go to spam since there's no SPF record. You'll need to manually whitelist that address on the receiving end.

[–] mumblerfish@lemmy.world 1 points 1 year ago (1 children)

Cannot find it in my spam-folder either, and with the mailutils mail I set also set the -r $emailFrom to something that is whitelisted in my spamfilter. But maybe my mail-service provider has some other block. Could that be? Or that it looks very fishy with an e-mail with only from, to, and subject headers non-empty?

[–] Illecors@lemmy.cafe 1 points 1 year ago (2 children)

You've initially said you wanted to receive it locally only. Now you're pulling external email providers into the mix. You need to set up spf and dmarc for that at the minimum. I can help you with it, but it's nowhere near as simple as just emailing a local user.

[–] Kit@lemmy.blahaj.zone 1 points 1 year ago (1 children)

You definitely don't need dmarc for that. Don't even need dkim, really.

[–] Illecors@lemmy.cafe 1 points 1 year ago

You are technically correct.

[–] mumblerfish@lemmy.world 1 points 1 year ago (1 children)

Sorry, I must not have explained myself very well. I guess it is the part on receiving on localhost. What I meant to say was that I would like the smtp, or whatever, to only be available on localhost, so that no one else on the network can use the service to send e-mails.

[–] Illecors@lemmy.cafe 2 points 1 year ago (1 children)

Postfix can be configured to only listen on localhost. Most things can be, actually.

[–] mumblerfish@lemmy.world 1 points 1 year ago (1 children)

Ah, postfix looks like what I'm looking for, thanks. Have to see if I can figure out how to configure it.

[–] Illecors@lemmy.cafe 2 points 1 year ago

ArchWiki, as always, is amazing.

[–] mumblerfish@lemmy.world 1 points 1 year ago

I tried a:

echo "something" | mailx -s "subject" [my_personal_email]

but I'm not receiving anything... hmm

[–] MattMckenzy@lemmy.ml 2 points 1 year ago

For a second I thought I had made the perfect solution for this, but then I realized my problem was the opposite. I was looking for a way to receive notifications from systems that can only send emails. So I quickly made the Mail2Gotify service and have been using it for the past while.

I'll post it here anyway in case you want to switch from emails to Gotify in the future!

https://github.com/MattMckenzy/Mail2Gotify

[–] lupec@lemm.ee 1 points 1 year ago

I know it's not exactly what you're looking for but I've explored some (free) options myself with good deliverability and ended up settling on smtp2go. Tied it to my domain, and it allows me to send 1000 emails/month hassle free. Everything else I looked into either wouldn't get delivered or costed way more I thought was worth for simple notifications.

I'll echo the other comment and say gotify could be a great option as well, I only stuck with email because it's easier on less tech literate family I provide services to and whatnot.