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"
  (insert "[email protected]")
  (insert "Notes from Emacs")
  (mml-attach-buffer (buffer-name (other-buffer)) "text/plain" "notes" "attachment"))

Calling my function creates the following email. enter image description here

However, the received email just contains the following string as plain text without any attachments. enter image description here

Creating the email manually with (mml-attach-buffer) works perfectly fine. enter image description here

enter image description here

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?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.