View Single Post
Old 23 Sep 2021, 06:57 PM   #2
Essential Contributor
Join Date: May 2018
Posts: 394
Originally Posted by Jacinto View Post
Cannot use the sender's E-Mail address because I also receive sent fax confirmations that do contain a Subject header.

The sender's name without the E-Mail address could be use because the name is different for sent fax confirmations.
Here, I guess, is a 1st approximation (tested with Sieve Tester):

if not exists "Subject" {
  if header :regex "From" "[[:space:]]*\"?(.*?)\"?[[:space:]]*<" {
    set "name" "${1}";
  } else {
    set "name" "what do you want to do if there is no name?";

  addheader "Subject" "${name}";
This uses the sender's name extracted from the "From" header if it's there. Not sure what you want to use if there is no name.

Note, the extraction of the name from the From header is more-or-less paraphrasing what FM generates for the UI "From name" (no preview) condition. It allows any number of leading spaces, names enclosed in quotes, and any number of spaces before the '<' preceding the email address. This match will fail if there is no name so I added a placeholder to handle that case but I don't know what you want to do for that case.
xyzzy is offline   Reply With Quote