poolp.org icon indicating copy to clipboard operation
poolp.org copied to clipboard

Example of a basic filter?

Open iambesi opened this issue 3 years ago • 1 comments

Hello @poolpOrg,

I recently came across your OpenSMTPD software and find it very interesting – in particular, the ease of configuration to get it up and running on a server. By no means am I a proper developer or expert in SMTP, but I do like to tinker and test things from time to time. That being said, I have been trying to set up OpenSMTPD to simply run as a local e-mail server for a few users, and also, as a relay to send e-mails outbound via an authenticated account.

In general, all of this works perfectly fine, but where I am struggling is with filters. I have looked at the related man-pages and read your articles, but still not quite piecing all the bits together. Whilst your articles provide a lot of great information on the technical theory behind your work on filters, what is missing is basic information and examples on how to get started. For example, if I wanted to have a filter that acts on a tx-rollback event, how would I 1) go about reading the event code-wise and 2) add a related configuration in smtpd.conf to properly reference my new filter?

For those of us who are not proper developers, it is quite difficult to know how to get started – even if we somewhat understand the theory behind filters. Case in point, someone on GitHub created a basic script -- https://github.com/Genues/opensmtpd-filter-replace-from_reply -- written in Go, which has been the clearest example (and probably about the only understandable one) that I have found. It is basic and easy to follow the logic and compile it for usage in OpenSMTPD.

With all that said, could you provide a basic example (it does not necessarily have to be written in Go) that encompasses the basic core bits of filters? I thank you in advance for any insight that you can offer.

Best regards, iambesi

iambesi avatar Jan 04 '22 01:01 iambesi

Hello @iambesi, I've created a short tutorial about it. I think this will give you a better overview about this topic. https://github.com/Beutlin/howto-opensmtpd-filters-and-reports

Greetings, Tobias

Beutlin avatar Apr 15 '22 02:04 Beutlin