Re: Sort to different maildir subdirs based on recipient address?

2020-06-30 Thread gilles
June 30, 2020 12:25 PM, "Unicorn"  wrote:

>> You have two methods to achieve what you want:
>> 
>> 1- use a smarter mda, such as `fdm`, which allows you to specify
>> where mails are supposed to be delivrered based on rules. in this
>> case, you would simply have a rule that recipient address blog@
>> should land in .Blog
> 
> I would like to try to stick to just smtpd, don't want to get in over
> my head with too many moving parts that I don't understand :)
> 
>> 2- alias blog to admin+blog instead of admin, this way when smtpd
>> extracts email extension, it will check if a .blog folder exists and
>> deliver there if exists but this is more limited that a real
>> classification.
> 
> I did not know that was possible, thank you! I tested it and it does
> exactly what I need it to, so I will go with this solution for now.
> 

Great :-)

I tend to use fdm because it lets you do really nice classification,
I encourage you to look at it for future uses !



> Have a great day,
> Unicorn
> 
> PS: I also wanted to say thanks for your awesome guide on setting up
> smtpd with rspamd and dovecot, it has helped me immensely and I
> actually massively appreciate the details that others may find
> trivial. It really helps as a beginner, I wish more people with your
> knowledge made such excellent guides to make these topics more
> accessible and understandable. :)
> 

Thanks !



Re: Sort to different maildir subdirs based on recipient address?

2020-06-30 Thread Unicorn
> You have two methods to achieve what you want:
> 
> 1- use a smarter mda, such as `fdm`, which allows you to specify
> where mails are supposed to be delivrered based on rules. in this
> case, you would simply have a rule that recipient address blog@
> should land in .Blog

I would like to try to stick to just smtpd, don't want to get in over
my head with too many moving parts that I don't understand :)


> 2- alias blog to admin+blog instead of admin, this way when smtpd
> extracts email extension, it will check if a .blog folder exists and
> deliver there if exists but this is more limited that a real
> classification.

I did not know that was possible, thank you! I tested it and it does
exactly what I need it to, so I will go with this solution for now.

Have a great day,
Unicorn


PS: I also wanted to say thanks for your awesome guide on setting up
smtpd with rspamd and dovecot, it has helped me immensely and I
actually massively appreciate the details that others may find
trivial. It really helps as a beginner, I wish more people with your
knowledge made such excellent guides to make these topics more
accessible and understandable. :)




Re: Sort to different maildir subdirs based on recipient address?

2020-06-30 Thread gilles
June 30, 2020 6:34 AM, "Unicorn"  wrote:

> Hello everyone,
> 

Hello,


> I am a newbie to mail in general and opensmtpd in particular and I am
> currently trying to figure out how to sort mail to various subdirs of
> the maildir based on the address that an email was sent to.
> 
> So basically, this is my intended setup:
> 
> 1. Somebody sends email to b...@mydomain.org
> 2. "blog" is an alias that forwards to a real "admin" account
> 3. In the maildir of "admin", the email goes to a subdir called "blog"
> 
> I looked through the the smtpd.conf(5) manpage and found the "match
> action" directive, my thought was something like this:
> 
> action "sort_to_folder" maildir "~/Maildir/.Blog" alias 
> match for rcpt-to "b...@mydomain.org" action "sort_to_folder"
> 
> But I found that with this setup, junk will not get removed, and if I
> add "junk" after the custom directory, I believe it will end up in
> "~/Maildir/.Blog/.Junk" instead of "~/Maildir/.Junk".
> 
> Is there a more elegant/smart solution that I am missing? I would be
> happy to learn from you. :)
> 

Yeah this won't work like that:

The maildir mda takes the maildir root directory as a parameter, it'll
expect .Junk to be relative.

You have two methods to achieve what you want:

1- use a smarter mda, such as `fdm`, which allows you to specify where mails are
   supposed to be delivrered based on rules. in this case, you would simply have
   a rule that recipient address blog@ should land in .Blog

2- alias blog to admin+blog instead of admin, this way when smtpd extracts email
   extension, it will check if a .blog folder exists and deliver there if exists
   but this is more limited that a real classification.

Gilles