Function: www-url-compose-mail

www-url-compose-mail is a byte-compiled function defined in hsys-www.el.

Signature

(www-url-compose-mail TO &optional SUBJECT BODY &rest IGNORE)

Documentation

Compose a mailto url and open it in the default browse-url web browser.

TO is the recipient's email address. Optional SUBJECT and BODY are included as parameters in the mailto url.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hsys-www.el
(defun www-url-compose-mail (to &optional subject body &rest _ignore)
  "Compose a mailto url and open it in the default `browse-url' web browser.
TO is the recipient's email address.  Optional SUBJECT and BODY
are included as parameters in the mailto url."
  (let ((browse-url-mailto-function browse-url-browser-function)
	(mailto (if (string-prefix-p "mailto:" to) to (concat "mailto:" to))))
    ;; Add subject if provided
    (when subject
      (setq mailto (concat mailto "?subject=" (url-encode-url subject))))
    ;; Add body if provided
    (when body
      (unless subject
        (setq mailto (concat mailto "?")))
      (setq mailto (concat mailto "&body=" (url-encode-url body))))
    (hact 'www-url mailto)))