Hello, I have a domain @example.com so I use any addresses like foo@example.com and bar@example.com , and they all end up in a single IMAP account. When replying, I have to set my “From” address manually to the one the e-mail was sent to, otherwise the default@example.com address is used. Would that be a task for a Python plugin (I am quite fluent there)? Thanks for suggestions.
Hi,
do you have filled the foo@ and bar@ addresses as aliases for the
default@ address? The aliases are set in the mail account Properties,
on the Identity tab (usually the first tab chosen when you open the
account Properties). That could be enough, but if not, then check
the Edit->Preferences->Composer Preferences->Send Account tab, where
you can set some rules which account/From address to use when and
where. You did not mention your Evolution version, but let’s hope you
do not have any ancient version.
Bye,
Milan
Thanks for the prompt reply, Milan. I don’t have those as aliases, since I create them dynamically (for different websites etc) as anything@example.com. So it seems the built-in handling will not help. If I were to write an extension (C is okay), which component do I need to extend? It is too late in EMsgComposer
, as that one gets constructed when clicking the “Reply” button… going through the source, it seems I would need to hook into em_utils_guess_mail_identity_with_recipients_and_sort, or somewhere there (ESourceMailIdentity
?) but I am getting lost there…
Hi,
you cannot “hook” to a function, you can “hook” only on the objects,
using the EExtension facility. I think the EMsgComposer is fine for
this, you only need to connect to the correct signals on the correct
objects and process what you’d like to change at the correct time. Some
signals can happen multiple times, like when the composer changes the
From account due to the folder is from a different account than the
default account is, then, if I’m not mistaken, the signal on the From
account change is emitted when the composer sets the default account
and then again, when it switches to the account related to the folder.
Maybe the GtkWidget::map signal on the composer would do the trick,
because it’s a time when the recipients and the From is already filled.
You probably found it yourself already, there’s some info for the
extensions:
which contains an example module as well, with which you might get
started a bit easier.
With the EMsgComposer instance you can get the header table with
e_msg_composer_get_header_table(), with which you can get to the
recipients (either e_composer_header_table_get_destinations() or its
variants) and according to its content you can set the From address
override (e_composer_from_header_set_name(),
e_composer_from_header_set_address() and make it visible
e_composer_from_header_set_override_visible(), because without that the
From override does not have any effect; search where these functions
are used in the e-msg-composer.c to get an idea about their arguments).
You will be able to change also the recipients (removing the special
address, as I guess it’s left as a recipient).
Bye,
Milan