The example 
here http://www.djcbsoftware.nl/code/mu/mu4e/Compose-hooks.html#Compose-hooks 
is 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]")
  "[email protected]")
 ((mu4e-message-contact-field-matches msg :to "[email protected]")
  "[email protected]")
 (t "[email protected]")))
                    (setq user-mail-address "[email protected]") ; default for COMPOSE
 )))

-- 
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.

Reply via email to