[Users] Help with Python compose_any script

Barry Warsaw barry at python.org
Thu Jul 10 19:39:43 CEST 2014


I have a nice compose_any Python script which looks at the To: and CC:
headers, analyzes the recipient address and selects an appropriate From header
in the composition window.  E.g. if the recipient is in the python.org domain,
then it selects my python.org email address; likewise for debian.org and so
on.

This worked great when I essentially had one outgoing SMTP because regardless
of the From contents, Claws would always choose the correct outgoing server
via that account (the only one possible, as all my SMTP-only accounts share
the same MTA settings).

Now however I want to send work related emails through my corporate SMTP and
everything else through the original SMTP.  Setting the From header, e.g. via:

            clawsmail.compose_window.set_from(choice)

does not select the account that the message is supposed to be sent from, and
thus the correct SMTP is not chosen.  I'm at a bit of a loss as to whether
this is even possible, let alone the best way to do it.  Does it involve
calling clawsmail.compose_window.get_account_selection() and then Doing
Something with that via Gtk?

Does anybody have an example of such a thing, or hints as to the best
approach?  Right now my plugin is pretty hardcoded to my personal email
addresses, but I could probably generalize it and donate it as a Python script
example, if anybody is interested.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20140710/576c6879/attachment.sig>


More information about the Users mailing list