[Rspamd-Users] How to rewrite subject with leading zeros of %d ?

Gerald Galster list+rspamd at gcore.biz
Mon Apr 24 14:27:43 UTC 2023


> I'm rewriting the subject of spammy mails like this:
> 
> subject = "+++SPAM+++(%d) %s"
> 
> Is it possible to write the score %d with leading zeros, i.e. (02) instead of (2) ?
> This would allow sorting the mails in the users JUNK folders.

Probably there is no easy way to do that, see:
https://github.com/rspamd/rspamd/blob/master/src/libserver/protocol.c#L1091

  %02d = "Just % something unknown"

In contrast to programmers, users are not used to leading zeros and it depends
on the MUA's sorting order (numerical sort, natural sort, ...).

There may be other solutions, like adding/parsing headers and altering
the subject with sieve or lua, e.g.

https://rspamd.com/doc/lua/
https://rspamd.com/doc/modules/milter_headers.html#custom-routines

Best regards,
Gerald







More information about the Users mailing list