Sieve 규칙에서 메시지 제목을 변경하는 방법은 무엇입니까?

Sieve 규칙에서 메시지 제목을 변경하는 방법은 무엇입니까?

나는 리스트를 통해 발송된 메일의 제목에 자신을 식별하지 않는 메일링 리스트를 구독하고 있습니다.
목록 메일을 내 기본 받은편지함으로 배달하고 싶지만 첫눈에 목록에서 도착하는 것으로 식별할 수 있습니다.

내 MTA(Dovecot)는 대부분의 Sieve 필터를 지원합니다.일반적인 확장.

이 목록의 메일 앞에 "[Foo-List]" 태그를 추가하려면 어떻게 해야 합니까?

답변1

메시지의 제목 헤더에 문자열을 직접 추가하거나 추가하는 표준화된 방법은 없는 것 같지만 editheadersvariables확장자를 사용하는 해결 방법이 있습니다.

require "editheader";
require "variables";

# Match/select your message as you see fit
if header :contains "List-Id" ["<foo.lists.example.net>"]
{
    # Match the entire subject ...
    if header :matches "Subject" "*" {
        # ... to get it in a match group that can then be stored in a variable:
        set "subject" "${1}";
    }

    # We can't "replace" a header, but we can delete (all instances of) it and
    # re-add (a single instance of) it:
    deleteheader "Subject";
    # Append/prepend as you see fit
    addheader :last "Subject" "[Foo-List] ${subject}";
    # Note that the header is added ":last" (so it won't appear before possible
    # "Received" headers).
}

관련 정보