Created
November 22, 2022 01:16
-
-
Save nelson/ba764899cf3caa2374b9219fdcafeccf to your computer and use it in GitHub Desktop.
Fastmail sieve - put email aliases into their own subfolder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# My custom sieve script for putting emails into their own subfolder | |
# Ref: https://www.reddit.com/r/fastmail/comments/qahdf3/my_custom_sieve_script_for_putting_emails_into/ | |
# | |
if exists "X-Delivered-to" { | |
# An email addressed to | |
# "website@user.domain.com" will be put in the folder "Website" | |
# "my-website@user.domain.com" will be put in the folder "My Website" | |
if header :regex "X-Delivered-to" "([A-z0-9]+)-?([A-z0-9]+)?@user.domain.com" { | |
if string :is "${2}" "" { | |
# Only first word is being used | |
set :lower :upperfirst "website" "${1}"; | |
} else { | |
# Two words are being used, let's capitalize both of them | |
set :lower :upperfirst "one" "${1}"; | |
set :lower :upperfirst "two" "${2}"; | |
set "website" "${one} ${two}"; | |
} | |
# Move email into its own folder under the inbox | |
fileinto :create "INBOX.${website}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: