32.4.4 Mail Miscellany
You can attach a file to an outgoing message by typing C-c C-a
(mml-attach-file
) in the mail buffer. Attaching is done using the Multipurpose Internet Mail Extensions (MIME) standard.
The mml-attach-file
command prompts for the name of the file, and for the attachment’s content type, description, and disposition. The content type is normally detected automatically; just type RET
to accept the default. The description is a single line of text that the recipient will see next to the attachment; you may also choose to leave this empty. The disposition is either ‘inline
’, which means the recipient will see a link to the attachment within the message body, or ‘attachment
’, which means the link will be separate from the body.
The mml-attach-file
command is specific to Message mode; in Mail mode use mail-add-attachment
instead. It will prompt only for the name of the file, and will determine the content type and the disposition automatically. If you want to include some description of the attached file, type that in the message body.
The actual contents of the attached file are not inserted into the mail buffer. Instead, some placeholder text is inserted into the mail buffer, like this:
<#part type="text/plain" filename="~/foo.txt" disposition=inline>
<#/part>
When you type C-c C-c
or C-c C-s
to send the message, the attached file will be delivered with it.
While composing a message, you can do spelling correction on the message text by typing M-x ispell-message
. If you have yanked an incoming message into the outgoing draft, this command skips what was yanked, but it checks the text that you yourself inserted (it looks for indentation or mail-yank-prefix
to distinguish the cited lines from your input). See Spelling.
Turning on Message mode (which C-x m
does automatically) runs the normal hooks text-mode-hook
and message-mode-hook
. Initializing a new outgoing message runs the normal hook message-setup-hook
; you can use this hook if you want to make changes to the appearance of the mail buffer. See Hooks.
The main difference between these hooks is just when they are invoked. Whenever you type C-x m
, message-mode-hook
runs as soon as the mail buffer is created. Then the message-setup
function inserts the default contents of the buffer. After these default contents are inserted, message-setup-hook
runs.
If you use C-x m
to continue an existing composition, message-mode-hook
runs immediately after switching to the mail buffer. If the buffer is unmodified, or if you decide to erase it and start again, message-setup-hook
runs after the default contents are inserted.