Hi Ken,
I think I have a solution for you, a hybrid of the two options. I just
tried it out myself, and it seems to work well for me. First set up your
list of email addresses, like in the longer configuration.
(setq mu4e-user-mail-address-list '("[email protected]"
"[email protected]"))
Then add the following hook:
(add-hook 'mu4e-compose-pre-hook
(defun my-set-from-address ()
"Set the From address based on the To address of the original."
(let ((msg mu4e-compose-parent-message)) ;; msg is shorter...
(setq user-mail-address
(cond
((and msg
(mu4e-message-contact-field-matches msg :to
"[email protected]"))
"[email protected]")
(t (completing-read "Compose with account: "
mu4e-user-mail-address-list
nil t nil nil (car
mu4e-user-mail-address-list))))))))
That should give the behavior you're looking for.
Chris
[email protected] writes:
> OK that is an improvement. I can now Compose. But if I add nothing to
> mu4e-compose-pre-hook then when I compose I get to interactively
> select one of my outgoing addresses. Now it defaults to the final (t
> [email protected]).
>
> -k.
>
> On Sun, 19 Jan 2014, Chris O'Donnell wrote:
>
>> Hi Ken,
>>
>> I'm actually just getting this set up myself and ran into the same problem.
>> My solution was to replace each condition with something like this:
>>
>> ((and msg (mu4e-message-contact-field-matches msg :to "[email protected]"))
>> "[email protected]")
>>
>> If you have a lot of email addresses, it might be cleaner to put this short
>> circuit outside the cond.
>>
>> Chris
>>
>> On Sunday, January 19, 2014 6:50:51 PM UTC-5, Ken Mankoff wrote:
>>>
>>> The example here
>>> http://www.djcbsoftware.nl/code/mu/mu4e/Compose-hooks.html#Compose-hooksis
>>> a nice example and when I hit "reply" my outgoing message is now based
>>> on who the incoming message was sent to.
>>>
>>> But when I try to compose a new message, rather than reply, it fails, with
>>> "message must be non-nil".
>>>
>>> I've tried modifying that function (see below), but cannot get it to work.
>>> Advice much appreciated...
>>>
>>> -k.
>>>
>>>
>>> (add-hook 'mu4e-compose-pre-hook
>>> (defun my-set-from-address ()
>>> "Set the From address based on the To address of the original."
>>> (let ((msg mu4e-compose-parent-message)) ;; msg is shorter...
>>> (if (boundp 'msg)
>>> (setq user-mail-address
>>> (cond
>>> ((mu4e-message-contact-field-matches msg :to "[email protected] <javascript:>")
>>> "[email protected] <javascript:>")
>>> ((mu4e-message-contact-field-matches msg :to "[email protected] <javascript:>")
>>> "[email protected] <javascript:>")
>>> (t "[email protected] <javascript:>")))
>>> (setq user-mail-address "[email protected] <javascript:>") ;
>>> default for COMPOSE
>>> )))
>>>
>>>
>>
>>
--
Sent with my mu4e
--
You received this message because you are subscribed to the Google Groups
"mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.