[Users] automatically changing From address

Dave Howorth dave at howorth.org.uk
Sun Jun 4 01:05:23 CEST 2017


On Sat, 3 Jun 2017 18:30:21 -0400
Barry Warsaw <barry at python.org> wrote:
> I have some Python scripts that I've been using for ages to do this,
> across all my email addresses (yes, I do the same thing as you, but
> also have many FLOSS project addresses).

Thanks for the script. Paul's suggestion to use folder templates is
working well for me at the moment, but I'll keep the script in case I
ever need it.

Cheers, Dave

> This is a rough outline; the details are suppressed.  Put this in
> ~/.claws-mail/python-scripts/auto/compose_any and season to taste.
> 
> -----snip snip-----
> from email.utils import parseaddr
> 
> DOT = '.'
> 
> for header, value in clawsmail.compose_window.get_header_list():
>     header = header.lower()
>     choice = None
>     if header in ('to:', 'cc:'):
>         realname, email = parseaddr(value.lower())
>         local, at, domain = email.partition('@')
>         superdomain = DOT.join(domain.split(DOT)[1:])
>         organization = DOT.join(domain.split(DOT)[-2:])
>         # Now you can test 'local', 'domain', 'superdomain', and
>         # 'organization' with whatever conditionals you want, e.g.
>         if domain == 'example.com':
>             choice = 'foo at example.com'
>         # ...
>         if choice is not None:
>             clawsmail.compose_window.set_from(choice)
>             break
> -----snip snip-----
> 
> Cheers,
> -Barry
> 
> On May 24, 2017, at 12:59 PM, Dave Howorth wrote:
> 
> >I get all the mail sent to my domain, and frequently use unique mail
> >addresses when communicating with firms (e.g. I might have subscribed
> >here using claws-mail at howorth.org.uk). When they send me mail, they
> >do so to these unique addresses, but if I reply to the mail it is
> >sent from my main address. I'd like it to be sent from the unique
> >address instead. Presently I do this by editing the From line
> >manually, but is it possible to do this automatically? i.e. Use the
> >To address as the From address when replying to mail?  




More information about the Users mailing list