Chris Cappuccio [ch...@nmedia.net] wrote:
> 
> When the DNS record is in place, email to l...@lists.nmedia.net results in 
> 500 5.4.6 Routing loop detected: Loop detected

After screwing with it more I realized the loop was because I had a rule

match from src <localnet> for any action "outbound"

ordered before

match from any for domain <listdomains> action list_mda

but, unlike pf, smtpd is a first matching rule system.

Also, to make it work I still had to create a user table, so I ended up with 
this:

--

/etc/mail/smtpd.conf:

table aliases file:/etc/mail/aliases
table list_virtual file:/etc/mda/list_virtual
table localnet { 10.0.0.0/8, 172.16.0.0/12 }
table mxdomains { mailthing.nmedia.net }
table list_domains { lists.nmedia.net }

listen on socket

listen on all

action local_mail mbox alias <aliases>
action outbound relay
action mxrelay relay backup mx mx.nmedia.net
action list_mda mda "/usr/local/bin/list-mda %{rcpt}" virtual <list_virtual>

match from any for domain <mxdomains> action mxrelay
match from any for rcpt-to <list_virtual> action list_mda
match ! rcpt-to <list_virtual> for domain <list_domains> reject

match from local for local action "local_mail"
match from local for any action "outbound"
match from src <localnet> for any action "outbound"

---

/etc/mda/list_virtual:

l...@lists.nmedia.net _smtpd
anotherl...@lists.nmedia.net _smtpd

--

I'm not sure if this is the right way to implement my mini mailing list, as I
end up with a Delivered-To header for the mailing list and another on actual
final delivery.

At least mesages do get delivered to the list-mda program which does some
header stuff and then broadcasts them to the list members.

It's kinda weird that, even though I have a virtual table, I still have to
reject:

match from any for rcpt-to <list_virtual> action list_mda
match ! rcpt-to <list_virtual> for domain <list_domains> reject

Maybe the mda thing is overkill and I can just use aliases. Now that i'm
looking, that's what other mailing list managers seem to be doing with
opensmtpd.

My list-mda is a very simple program that reads a subject prefix and reply-to
header from a config file, along with the list recipients, and then sets up
the headers and blasts the email out. I wanted something simple that could
pledge and unveil (the unveil isn't going so well) and that would be 
extremely minimal. No majordomo or mailman or sympa or whatever. If I really
want subscribe and unsubscribe, I can just build that later. As it is now, I
only want mailing lists for a small organization that won't change.

Reply via email to