![Sieve 규칙에서 메시지 제목을 변경하는 방법은 무엇입니까?](https://rvso.com/image/1609675/Sieve%20%EA%B7%9C%EC%B9%99%EC%97%90%EC%84%9C%20%EB%A9%94%EC%8B%9C%EC%A7%80%20%EC%A0%9C%EB%AA%A9%EC%9D%84%20%EB%B3%80%EA%B2%BD%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
나는 리스트를 통해 발송된 메일의 제목에 자신을 식별하지 않는 메일링 리스트를 구독하고 있습니다.
목록 메일을 내 기본 받은편지함으로 배달하고 싶지만 첫눈에 목록에서 도착하는 것으로 식별할 수 있습니다.
내 MTA(Dovecot)는 대부분의 Sieve 필터를 지원합니다.일반적인 확장.
이 목록의 메일 앞에 "[Foo-List]" 태그를 추가하려면 어떻게 해야 합니까?
답변1
메시지의 제목 헤더에 문자열을 직접 추가하거나 추가하는 표준화된 방법은 없는 것 같지만 editheaders
및 variables
확장자를 사용하는 해결 방법이 있습니다.
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).
}