Add function to insert an inline image into a message-md email
This commit is contained in:
parent
439aa316ba
commit
46a1e3147c
@ -4250,6 +4250,27 @@ Support sending rich-text emails via Markdown:
|
||||
(point)
|
||||
(insert description "\n")))
|
||||
(mail-encode-encoded-word-region description (point))))))
|
||||
|
||||
(defun message-md-insert-inline-image (image type description)
|
||||
(interactive
|
||||
(let* ((file (mml-minibuffer-read-file "Insert image: "))
|
||||
(type (if current-prefix-arg
|
||||
(or (mm-default-file-encoding file)
|
||||
"application/octet-stream")
|
||||
(mml-minibuffer-read-type file)))
|
||||
(description (if current-prefix-arg
|
||||
nil
|
||||
(mml-minibuffer-read-description))))
|
||||
(list file type description)))
|
||||
(let ((id (format "%s%s" (s-snake-case description) (random))))
|
||||
(insert (format "![%s](cid:%s)" description id))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(newline)
|
||||
(insert
|
||||
(format (concat "<#part id=\"<%s>\" x-attachment-id=%S "
|
||||
"type=%S filename=%S disposition=inline description=%s>")
|
||||
id id type image description)))))
|
||||
#+END_SRC
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user