Skip to content

Instantly share code, notes, and snippets.

@indrora
Created January 31, 2012 06:39
Show Gist options
  • Save indrora/1709261 to your computer and use it in GitHub Desktop.
Save indrora/1709261 to your computer and use it in GitHub Desktop.
Claws python script for auto-re-from
#!/usr/bin/env python
# Script run by Claws-mail
# save this as ~/.claws-mail/python-scripts/auto/compose_any
# Makes sure right-side is set as From: if any To: match left-side
replacements = {
'wat_list@pingas.tld':'herpderp@immpaperp.tld'
}
to_addresses = [ x[1] for x in clawsmail.compose_window.get_header_list() if x[0] == "To:"]
def mangle_names():
for name in to_addresses:
for possible_replacement in replacements.keys():
if(name in possible_replacement):
clawsmail.compose_window.set_from(replacements[name])
break
mangle_names()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment