top | item 35013926

(no title)

olivertaylor | 3 years ago

You can also do this with the system's built-in mail program. I set this up for doing bulk emails a while ago and it has proved very useful and versatile.

    (defun compose-mail-macos (&optional to subject body)
      "Compose a message using macOS's default mail program."
      (interactive)
      (start-process "Open Mail Message" nil "open"
                     (concat "mailto:"
                             (when to to) "?"
                             (when subject (concat "&subject=" (url-hexify-string subject)))
                             (when body (concat "&body=" (url-hexify-string body))))))
    
    (defun compose-mail-macos-multiple (list subject body)
      "ADDRESSES should be a list of email addresses in the form of:
    (setq mail-list '(\"Mail 1 <mail1@example.com>\"
                      \"Mail 2 <mail2@example.com>\"
                      \"Mail 3 <mail3@example.com>\"))"
      (while list
        (let ((to (car list)))
          (compose-mail-macos to subject body)
          (setq list (cdr list)))))

discuss

order

No comments yet.