I have customized the message-citation-line-format variable and that format now appears in replies and forwards. But I would like to set different quote strings depending on whether I am replying or forwarding an email. For example, "On [date], [person] wrote:" when replying but a longer multi-line string (including "from," "to," and "date" fields) when forwarding. Is that possible?

3 Answers 3


There's a hook run before message composition starts, so you can check the last-command to change the citation line conditionally:

(defun citation-line-function ()
  (setq message-citation-line-format
        (if (eq last-command 'mu4e-compose-reply)
            "\nOn %a, %b %d %Y, %N wrote:\n"
          (let (addresses)
            (mapcar (lambda (to)
                      (let* ((name (or (car-safe to) ""))
                             (email (cdr-safe to)))
                        (push (format "%s <%s>" name email) addresses)))
                    (mu4e-message-field-at-point :to))
            (concat "\nFrom: %f\nTo: "
                    (mapconcat #'identity addresses ", ") "\n")))))

(add-hook 'mu4e-compose-pre-hook 'citation-line-function)

Note also that to insert a formatted citation line, you will need to update the message-citation-line-function variable as follows:

(setq message-citation-line-function 'message-insert-formatted-citation-line)
  • Note that you also have to set (setq message-citation-line-function 'message-insert-formatted-citation-line) for this to take effect
    – Tyler
    Commented Oct 19, 2021 at 14:01
  • Indeed, @Tyler. Thanks for pointing that out.
    – jagrg
    Commented Oct 20, 2021 at 12:20
  • Thanks a lot, @jagrg, for the pointer to mu4e-compose-pre-hook. A modified version of this function is what I am using now. I will add it in an answer.
    – A.Apte
    Commented Oct 21, 2021 at 5:39
  • In the above answer, "%f" is for the "from" email address of the original email. Similar to that is there something for email addresses in the "To" and "Cc" field? I could not find any place where the different "variables" (like "%T" for "time" or "%a" for "Day") are listed.
    – A.Apte
    Commented Oct 21, 2021 at 6:16
  • When you forward a message the To field is blank, so I'm not sure what you're trying to do here.
    – jagrg
    Commented Oct 22, 2021 at 11:18

A modified version of the function in the answer by @jagrg is what I am using now. Here it is.

(defun citation-line-function ()
  (setq message-citation-line-format
    (if (eq mu4e-compose-type 'reply)
        "On %a %d %b %Y %T %z (%Z), %f wrote:\n"
      (if (eq mu4e-compose-type 'forward)
          "----- Forwarded message -----\nFrom: %f\nDate: %a %d %b %Y %T %z (%Z)\n\n"

(add-hook 'mu4e-compose-pre-hook 'citation-line-function)

This gives something like the following On Thu 21 Oct 2021 10:50:50 +0530 (IST), [email protected] wrote: when replying and when forwarding,

----- Forwarded message -----
From: [email protected]
Date: Thu 21 Oct 2021 10:50:50 +0530 (IST)


From mu4e 1.12.0 much of the mu4e-specific setup are removed and more of message is reused. This means the differing functions and settings for replying and forwarding from message applies, which by default gives a result similar to that asked in the original question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.