I am working on a function that sends the current buffer as an email attachment. Here is my code
(defun my/buffer-to-ipad ()
"Send current buffer as email attachment to iPad via email"
(interactive)
(mail)
(mail-to)
(insert "[email protected]")
(mail-subject)
(insert "Notes from Emacs")
(mml-attach-buffer (buffer-name (other-buffer)) "text/plain" "notes" "attachment"))
Calling my function creates the following email.
However, the received email just contains the following string as plain text without any attachments.
Creating the email manually with (mml-attach-buffer)
works perfectly fine.
Why can't I just put (mml-attach-buffer)
into my function? And what if my buffer name contains <
or >
characters? How can I escape them to avoid messing up the HTML in the email?