Function: message-use-alternative-email-as-from

message-use-alternative-email-as-from is a byte-compiled function defined in message.el.gz.

Signature

(message-use-alternative-email-as-from)

Documentation

Set From field of the outgoing message to the first matching address in message-alternative-emails, looking at To, Cc and From headers in the original article.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-use-alternative-email-as-from ()
  "Set From field of the outgoing message to the first matching
address in `message-alternative-emails', looking at To, Cc and
From headers in the original article."
  (require 'mail-utils)
  (let* ((fields '("To" "Cc" "From"))
	 (emails
	  (message-tokenize-header
	   (mail-strip-quoted-names
	    (mapconcat
	     #'identity
	     (cl-loop for field in fields
		      for value = (message-fetch-reply-field field)
		      when value
		      collect value)
	     ","))))
	 (email
          (cond ((functionp message-alternative-emails)
                 (car (cl-remove-if-not message-alternative-emails emails)))
                (t (cl-loop for email in emails
                            if (string-match-p message-alternative-emails email)
                            return email)))))
    (unless (or (not email) (equal email user-mail-address))
      (message-remove-header "From")
      (goto-char (point-max))
      (insert "From: " (let ((user-mail-address email)) (message-make-from))
	      "\n"))))