help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I get attachments to stick and actually be sent with an emai


From: Sharon Kimble
Subject: Re: How can I get attachments to stick and actually be sent with an email using 27.0.91?
Date: Sat, 20 Jun 2020 12:53:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I've just spent a frustrating 20 minutes trying to attach a pdf file to
>> an email to be sent with the email itself. I've tried attaching a file,
>> attaching a buffer, and also attaching an external pdf file. None of
>> them were successful, so how can I do it please?
>
> I do
>
>     M-x *-att-fil RET
>
> which completes to `mml-attach-file`.
>

And searching for 'mm-substring-no-properties' in my config turns up this

- --8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp
(setq mml-attach-files-at-end t)

(defun mml-attach-file (file &optional type description disposition)
  "Attach a file to the outgoing MIME message.
The file is not inserted or encoded until you send the message with
`\\[message-send-and-exit]' or `\\[message-send]' in Message mode,
or `\\[mail-send-and-exit]' or `\\[mail-send]' in Mail mode.

FILE is the name of the file to attach.  TYPE is its
content-type, a string of the form \"type/subtype\".  DESCRIPTION
is a one-line description of the attachment.  The DISPOSITION
specifies how the attachment is intended to be displayed.  It can
be either \"inline\" (displayed automatically within the message
body) or \"attachment\" (separate from the body)."
  (interactive
   (let* ((file (mml-minibuffer-read-file "Attach file: "))
          (type (mml-minibuffer-read-type file))
          (description (mml-minibuffer-read-description))
          (disposition (mml-minibuffer-read-disposition type nil file)))
     (list file type description disposition)))
  ;; If in the message header, attach at the end and leave point unchanged.
  (let ((head (unless (and (message-in-body-p) (not mml-attach-files-at-end)) 
(point))))
    (if (or head mml-attach-files-at-end) (goto-char (point-max)))
    (mml-insert-empty-tag 'part
                          'type type
                          ;; icicles redefines read-file-name and returns a
                          ;; string w/ text properties :-/
                          'filename (mm-substring-no-properties file)
                          'disposition (or disposition "attachment")
                          'description description)
    ;; When using Mail mode, make sure it does the mime encoding
    ;; when you send the message.
    (or (eq mail-user-agent 'message-user-agent)
        (setq mail-encode-mml t))
    (when (or head mml-attach-files-at-end)
      (unless (pos-visible-in-window-p)
        (message "The file \"%s\" has been attached at the end of the message"
                 (file-name-nondirectory file)))
      (goto-char head))))
#+end_src
[2015-03-27 Fri 16:34]
https://groups.google.com/forum/#!msg/gnu.emacs.gnus/4hzShoQEff4/9-CjUhEkLFMJ
- --8<---------------cut here---------------end--------------->8---

Now that code worked in emacs-26, but its failing in emacs-27.0.91. And,
being as that code has been in use since March 2015 it may well be past
its use-by-date!

So can anyone help me out please?

Thanks
  Sharon.
- -- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 10.2, fluxbox 1.3.7, emacs 27.0.91, org 9.3.7
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl7t+M0bHGJvdWRpY2Nh
c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INbaMMP/27JG5GCC1kpulHzk/zU
sSzXRuFQSLTr/Ek+3a0+h0ea0r93ZDhN5Rbp0J9MoGJIcdBta3XScOrDJlfbf2rC
OElENchupvTZGpBNQDsMke+MzNvjiIDWPHyAAnb9iuqLQyjaQE1qz4/2QuLlE39x
zUmVC/pvXAc9xDxvJLi/RzYa5xGGmy8QIL4+IHXbNeNDhw4MR6s6e9WrtudjWqfE
ZGXAsWhKWMmQy80uTQYSps+tSyVOYW7zYWVrQV1z5Bc9tAW6H4VPQ1YQLIBOQL0Z
gH6SqP+Evb7ZXI1fsd0PPtM/sCMhonLgC9zFLb9KF0TFXxYIATMr1br39x7wAIPr
GGr6QWgJPlmwjBYhuX8QM2ON4raSExaQjB2wFsa7RQ8tdrbWVBO3INMj8FSPXU5z
ikkb4i4Ep9Qsee/lGuKO6h+dntw1LPDypIqf28+rQFlxvdy0tWNosTffarO1LAle
jC1kJAGHXyVidC1P792rDlsMQnU/ZG5wMYVMOzjeSpLNA2zdiZAJe+jrYYL1Tna5
Dvz40GpHhHqXlD0QBDkinmvl0VjzddSzKCYbpfcytKzeu3hDGtw7JdP2GhRbSvfD
eJFxZwhGB53H4SSfkK1cGdMgSJef7d6IRZYaA1EgxuJ461+hDNAtf+ubtBRxH8Dy
ufDalfvbU4FtUo2GUYmEZa2n
=rZcf
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]