You basically write a script that processes incoming lines on stdin, and writes back to stdout. The protocol is described in smtpd-filters(7).

This basic idea in lua would be something like:

for line in io.lines() do
    if line == 'in' then
        io.write('out')
    end
end

Now handle the lines you want to handle, and respond to them how it's described in smtpd-filters(7).


On Fri, Oct 20, 2023 at 09:52:41PM +0200, Sagar Acharya wrote:
I'm simply unable to start.

I have to know where to get the mail from, format of text, which process to give the return to, in what format, i.e. are there any standard return values for accept or reject mail.
Thanking you
Sagar Acharya
https://humaaraartha.in/selfdost/selfdost.html



20 Oct 2023, 23:47 by tphil...@potion-studios.com:

Post your script that you got so far, explain where you get stuck/confused, and 
someone will probably be happy to help.


On Fri, Oct 20, 2023 at 02:05:13PM +0200, Sagar Acharya wrote:

Can you please help me with a sample script for accepting or rejecting mail in 
lua.

Say there is myfilter.lua within /etc/smtpd/

Can one please help with a sample whose pseudocode goes like

fetch(mail)if mailbody contains foo, reject,
else if mailbody contains bar, accept.

Such a sample script would help very much to support users write their own custom filters. Thanking you Sagar Acharya
https://humaaraartha.in/selfdost/selfdost.html



Reply via email to