Are there such tutorials in Lua?

filter keep proc-exec /path/to/script.lua

With above configuration, how does the script run? How is mail input given to 
it? At what step can I get size of attachments without downloading them.

if sizeof_attach(mail)>0
return 0;

Does it work like cgi, i.e. standard output?


Thanking you
Sagar Acharya
https://humaaraartha.in/selfdost/selfdost.html



14 Oct 2023, 18:52 by kolip...@exoticsilicon.com:

> On Sat, Oct 14, 2023 at 03:06:11PM +0200, Sagar Acharya wrote:
>
>> How do I reject all emails with attachments by using an opensmtpd filter?
>>
>
> You need to parse the content of the emails using the data-line filter event.
>
> You'll probably want to check the headers for Mime-Version: and Content-Type:.
>
> If the message is indeed Mime encoded then look in the message body for the
> Content-Type: header again, and decide whether to pass it or reject it.
>
> (You might want to pass some attachments such as plain text or text/html, and
>  reject all others.)
>
>> At what step do I set the filter? rcpt-to, data, or commit step?
>>
>
> You will need to parse several events, probably at least:
>
> link-connect
> link-disconnect
> data-line
>
> and maybe others.
>
>> Any tutorials are appreciated.
>>
>
> If you want a general tutorial about writing filters in C, you could look at:
>
> https://research.exoticsilicon.com/articles/mail_filters
>
> Some of the content is applicable to other programming languages too, but the
> tutorial is based on programming in C.
>

Reply via email to