## 4 Sending Messages ¶

When sending messages from within VM, you will be using the standard mail sending facility provided with Emacs, plus some extensions added by VM. See Sending Mail in the GNU Emacs Manual. Emacs comes with two versions of mail sending packages, called “mail mode” and “message mode”. VM currently uses the “mail mode” package, which is not too dissimilar to the “message mode” package.

Even though VM’s mail composition buffers will be in “mail mode”, they have some extra command keys.

`C-c C-y (`vm-yank-message`)` ¶

  Copies a message from the folder that is the parent of this composition into the mail composition buffer. The message number is read from the minibuffer. By default, each line of the copy is prepended with the value of the variable `vm-included-text-prefix`. All message headers are yanked along with the text. Point is left before the inserted text, the mark after. Any hook functions bound to `mail-yank-hooks` are run, after inserting the text and setting point and mark. If a prefix argument is given, this tells VM: ignore `mail-yank-hooks`, don’t set the mark, don’t prepend the value of `vm-included-text-prefix` to every yanked line, and don’t yank any headers other than those specified in `vm-visible-headers` and `vm-invisible-headers`.

``M-x vm-yank-message-other-folder``

  This allows one to yank a message from a different folder than the parent of this composition.

`C-c C-v <Any VM command key>` ¶

  All VM commands may be accessed in a VM Mail mode buffer by prefixing them with C-c C-v.

`C-c C-a (`vm-attach-file`) or drag-and-drop a file`

  Attaches a file to the composition. When you send the message, VM will insert the file and MIME encode it. The variable `vm-send-using-mime` must be set non-`nil` for this command to work. You will be asked for the file’s type, and a brief description of the attachment. The description is optional. If the file’s type is a text type, you will also be asked for the character set in which the text should be displayed. The new attachment will appear as a highlighted tag in the composition buffer. You can use mouse button 3 on this tag to set the default content disposition of the attachment. The content disposition gives a hint to the recipient’s mailer how to treat the attachment. Specifically the disposition will indicate whether the attachment should be displayed along with the message or saved to a file. Any text in the composition that appears before the tag will appear in a MIME text part before the attachment when the message is encoded and sent. Similarly, any text after the tag will appear after the attachment in the encoded message. If you change your mind about using the attachment, you can remove it from the composition with `C-k`. If you want to move the attachment to some other part of the message, you can kill it `C-k` and yank it back with `C-y`.

`C-c C-m (`vm-attach-message`)` ¶

  Attaches a mail message to the composition. If invoked with a prefix argument, the name of a folder is read from the minibuffer and the message or messages to be attached are copied from that folder. You will be prompted for the message number of the message to be attached. If you invoke the command on marked messages by running `vm-next-command-uses-marks` first, the marked messages in the selected folder will be attached as a MIME digest.

`C-c C-b (`vm-attach-buffer`)`

  Attaches an Emacs buffer to the composition.

`C-c C-e (`vm-mime-encode-composition`)` ¶

  Encodes the composition using MIME, but does not send it. This is useful if you want to use PGP to sign a message before sending it. After signing the message, you would use `C-c C-c` as usual to send the message. Emacs’ `undo` command can be used to undo the encoding, so that you can continue composing the unencoded message.

`C-c C-p (`vm-preview-composition`)` ¶

  Previews the current composition. The message is copied into a temporary folder and you can read the message and interact with it using normal VM mode commands to see how it might look to a recipient. Type `q` to quit the temporary folder and resume composing your message.

The simplest command is `m` (`vm-mail`) which sends a mail message much as `M-x mail` does but allows the added commands described above.

`vm-mail` can be invoked outside of VM by typing `M-x vm-mail`. However, only (`vm-yank-message-other-folder`) will work; all the other commands require a parent folder.

If you send a message and it is returned by the mail system because it was undeliverable, you can resend the message by typing `M-r` (`vm-resend-bounced-message`). VM will extract the old message and its pertinent headers from the returned message, and place you in a VM Mail mode buffer. A Resent-To header will be added, which you can fill in with the corrected addresses of the recipients that bounced. You can also added a Resent-Cc header, which has the same meaning as a Cc header in a normal message. Mail will only be sent to the addresses in the Resent-To and Resent-Cc headers unless you delete both of those headers. In that case the To and Cc headers will be used.

### 4.1 Mail Sending Options ¶

As already mentioned, VM uses Emacs Mail Mode in the Gnu Emacs Manual for sending email. Therefore, Mail Mode options should be set to configure the mail sending. The extra options provided by VM are described below.

The variable `vm-mail-auto-save-directory` can be used to specify the directory in which the message composition buffers should be auto-saved. If it is nil, the `vm-folder-directory` is used for auto-saving.

When a mail composition buffer is created, VM initializes it with header lines that you can fill in. The `From` header is usually standard and contains your email address. You can have VM fill it in for you automatically by setting the variable `vm-mail-header-from`. (It is `nil` by default.)

The variable `vm-mail-use-sender-address`, if set to `t`, asks VM to fill in the `To` header from the sender’s name and address of the current message. This has effect only when `vm-mail` is invoked from a VM folder. When it is invoked from other buffers, the `To` headers is unfilled. (Some people tend to use `vm-reply` to get this effect, but that is a bad practice because it also tags the new message as a reply to an older message.)

The variable `vm-mail-mode-hidden-headers` can be used to hide some of the header lines from the mail composition buffer. By default, the headers “References” and “X-Mailer” are hidden.

Additional header lines are created by VM before the composed message is sent. The variable `vm-mail-header-insert-date` can be set to `t` (which is the default value) asking VM to insert a Date header into a message before it is sent. You should set it to `nil` if you would like to insert a Date header yourself. The variable `vm-mail-header-insert-message-id` asks VM to insert a Message-ID header before sending the message. The variable `vm-mail-reorder-message-headers` asks VM to reorder the message headers into a particular order before sending. The order is determined by the variable `vm-mail-header-order`.

### 4.2 Sending MIME Messages ¶

To use VM’s MIME composition features, you must have `vm-send-using-mime` set to a non-`nil` value. With MIME composition enabled, VM will allow you to add file attachments to your composition and will analyze your message when you send it and MIME encode it as necessary.

### MIME attachments ¶

To attach a file to your composition, use `C-c C-a` (`vm-attach-file`). VM will ask you for the name of the file, its type, a brief description and its character set if it is a text attachment.

An attachment will be represented in the composition as a tag line like this

[ATTACHMENT ~/sounds/chronophasia_scream.au, audio/basic]

You can type text before and after this tag and it will appear before or after the text in the final MIME message when VM encodes it. You can kill the tag with `C-k` and yank it back with `C-y` to move it to another place in the message. You can yank back the tag multiple times to duplicate the attachment in the message. Or you can leave the tag killed and the attachment won’t appear in the message when it is sent.

If you click the right mouse button on the attachment tag, a menu will appear that allows you to change the content disposition of the attachment. The Content-Disposition of a MIME object gives a mail reader a hint as to whether the object should be displayed inline or as an inert tag or button that you must activate in some fashion. Inline display usually means that the object will be displayed within or alongside the message text, if that is possible. Attachment, when used as a content disposition, means that the object will likely be displayed as a tag. By default, VM specifies an inline disposition for all MIME types except ‘`application`’ and ‘`model`’ types.

To attach a buffer instead of a file, use `C-c C-b` (normally bound to `vm-attach-buffer`. You must not kill the buffer that you attach until after the message has been sent.

You can attach a message from another folder by using `C-c C-m` (`vm-attach-message`). By default, the folder is the parent folder of the message composition. If there is no parent folder, then a folder name will be read from the minibuffer. The message number of the message to be attached is also read from the minibuffer. Alternatively, you can mark one or more messages in the parent folder before invoking this command. All the marked messages will be attached as a digest in the outgoing message.

#### Point-to-point attachment operations ¶

A number of point-to-point operations allow you to attach objects from other editing contexts to a message you are composing.

You can visit a directory in Emacs (see Dired in the GNU Emacs Manual), and run `vm-dired-attach-file` on any file. The file be attached to your message composition. You can also mark a set of files in Dired and run `vm-dired-do-attach-files` to attach all of them.

You can use your Window system to drag and drop a file into a composition buffer (`vm-dnd-attach-file`).

When you visit a folder in VM, you can attach a message from the folder by running `vm-attach-message-to-composition`. When viewing a message that has MIME attachments, you can attach any of those attachments to your message composition by using the `$ a` (`vm-reader-map-attach-to-composition`) function. (See Operating on MIME attachments.) This operation is also available on the pop-menu for attachments.

In all these cases, you will be prompted for the message composition buffer to which you would like to attach the objects. The default is the latest message you have been composing, as indicated by the Emacs buffer ring.

### MIME characters ¶

By default, when you type text into a composition buffer VM assumes that if all the character codes are less than 128, you are using the US-ASCII character set and that is the character set declared in the encoding of the message when it is sent. If you are using some other character set, you must specify it by setting the variable `vm-mime-7bit-composition-charset`. The value of this variable should be a string specifying the character set.

If there are character codes in the composition greater than 128, the variable `vm-mime-8bit-composition-charset` tells VM what character set to assume when encoding the message. The default is ‘`iso-8859-1`’.

Character codes greater than 128 may not be transported reliably across the Internet in mail messages. Some machines will refuse to accept messages containing such characters and some will accept them but zero the eighth bit, garbling the message. To avoid these problems, VM transfer encodes 8-bit text by default.

MIME has two transfer encodings that convert 8-bit data to 7-bit data for safe transport. Quoted-printable leaves the text mostly readable even if the recipient does not have a MIME-capable mail reader. BASE64 is unreadable without a MIME-capable mail reader.

VM’s text transfer encoding behavior is controlled by the variable `vm-mime-8bit-text-transfer-encoding`. Its value should be a symbol that specifies what kind of transfer encoding to do for 8-bit text. A value of ‘`quoted-printable`’, means to use quoted-printable encoding. A value of ‘`base64`’ means to use BASE64 encoding. A value of ‘`8bit`’ means to send the message as is. Note that this variable usually only applies to textual MIME content types. Images, audio, video, etc. typically will have some attribute that makes VM consider them to be “binary”, which moves them outside the scope of this variable. For example, messages with line lengths of 1000 characters or more are considered binary, as are messages that contain carriage returns (ASCII code 13) or NULs (ASCII code 0).

### MIME headers ¶

The internet standards specify that the header lines of messages should always be in 7 bit ASCII, even if the body of a message can use an 8 bit character set. If you use other non-ASCII characters in typing the headers then VM encodes their words using the MIME encoded-word syntax, which is of the form `=?charset?encoding?encoded text?=`.

The variable `vm-mime-encode-headers-regexp` specifies which headers should be encoded in this way. By default, ‘`Subject`’, ‘`Organization`’, ‘`From`’, ‘`To`’, ‘`CC`’, ‘`Bcc`’ and ‘`Resent-`’ header lines encoded. The words are encoded using quoted-printable encoding (`Q`). You can ask VM to use the base64 encoding by setting the variable `vm-mime-encode-headers-type`.

The variables `vm-mime-encode-words.regexp` and `vm-mime-encode-headers-words-regexp` control what is meant by a “word” for VM for the purpose of encoding. By default, the words are those containing any 8 bit character and delimited by white space characters.

### MIME preview ¶

To preview what a MIME message will look like to a recipient, use `C-c C-p` (`vm-mime-preview-composition`). VM will encode a copy of the message and present it to you in a temporary mail folder. You can scroll through the message using normal VM mail reading commands. Typing `q` in this folder will return you to your composition where you can make further changes.

To encode a MIME message without sending it, use `C-c C-e` (`vm-mime-encode-composition`). This is useful if you use PGP and want to sign a message before sending it. VM will encode the message for transport, inserting all necessary headers and boundary markers. You can then sign the message and send it with C-c C-c and be confident that VM won’t invalidate the signature by making further modifications to the message. Or if you want to resume editing the message you can run the Emacs `undo` (normally bound to `C-x u`) command which will revert the encoded MIME bodies back to tags and you can continue entering your composition.

### 4.3 Replying ¶

VM has special commands that make it easy to reply to a message. When a reply command is invoked, VM fills in the subject and recipient headers for you, since it is apparent whom the message should be sent to and what the subject should be. There is an old convention of prepending the string ‘`Re:` ’ to the subject of replies if the string isn’t present already. You can customize the string to be prepended in this way by setting the variable `vm-reply-subject-prefix`. Its value should be a string to prepend to the subject of replies, if the string isn’t present already. A `nil` value means don’t prepend anything to the subject (this is the default). In any case you can edit any of the message headers manually, if you wish.

VM also helps you cite material from the message to which you are replying, by providing included text as a feature of some of the commands. Included text is a copy of the message being replied to with some prefix to each line so that the included text can be distinguished from the text of the reply. By default, the prefix string is ‘`>` ’. This can be customized via the variable `vm-included-text-prefix`.

The reply commands are:

`r (`vm-reply`)` ¶

  Replies to the author of the current message.

`R (`vm-reply-include-text`)`

  Replies to the author of the current message and provides included text.

`f (`vm-followup`)`

  Replies to the all recipients of the current message.

`F (`vm-followup-include-text`)`

  Replies to the all recipients of the current message and provides included text.

These commands all accept a numeric prefix argument n, which if present, causes VM to reply to the next (or previous if the argument is negative) n-1 messages as well as the current message. Also, all the reply commands set the “replied” attribute of the messages to which you are responding, but only when the reply is actually sent. The reply commands can also be applied to marked messages. (see Marking Messages.)

If you are one of multiple recipients of a message and you use `f` and `F`, your address will be included in the recipients of the reply. You can avoid this by judicious use of the variable `vm-reply-ignored-addresses`. Its value should be a list of regular expressions that match addresses that VM should automatically remove from the recipient headers of replies. The default value is `nil`, which means that no addresses are removed.

The variable `vm-in-reply-to-format` specifies the format of the In-Reply-To header that is inserted into the header section of the reply buffer. Like `vm-included-text-attribution-format`, `vm-in-reply-to-format` should be a string similar to that of `vm-summary-format`. A `nil` value causes the In-Reply-To header to be omitted. If the format includes elements that can contain non-ASCII characters, then ‘`In-Reply-To`’ should be added to `vm-mime-encode-headers-regexp`.

The recipient headers generated for reply messages are created by copying the appropriate headers from the message to which you are replying. This includes any full name information, comments, etc. in these headers. If the variable `vm-strip-reply-headers` is non-`nil`, the recipient headers will be stripped of all information except the actual addresses.

#### Included text ¶

As mentioned above, the commands `vm-reply-include-text` and `vm-followup-include-text` provide “included text” from the original message in your reply. In addition, you can use `C-c C-y` (`vm-yank-message`) inside a mail buffer to include text from any desired mail message. This is a more general mechanism for citing message text in the composed message. (The composed message does not have to be a reply. Neither do the cited messages have to be the messages you are replying to.)

Citing message text is a tricky business because the original message could be a MIME message with encoded text or formatted text along with embedded images and attachments. By default, VM uses its MIME displaying mechanism to extract the included text to be cited in replies. The quoted text is then similar to what appears in the message Presentation buffer. However, the MIME attachments are not included by default. They are shown in the message composition buffer with attachment buttons labelled similar to:

    [DELETED ATTACHMENT mary.jpg, image/jpeg]

If you set the variable `vm-include-mime-attachments` then the attachment buttons are converted to actual attachments before the message is sent. The format of the button in this case looks like:

    [ATTACHMENT mary.jpg, image/jpeg]

When citing a `multipart/alternative` MIME component, VM chooses the alternative specified by the variable `vm-mime-alternative-yank-method`. It can be defined similar to the variable `vm-mime-alternative-show-method`. (see MIME multipart/alternative.)

If the included text contains long lines, i.e., lines longer than the normal window width, you might want to fill paragraphs. You can invoke automatic filling of paragraphs by setting the variable `vm-fill-paragraphs-containing-long-lines-in-reply`. Like its namesake used in message presentation (see Paging), it should be set to a positive numerical value N or the symbol `window-width`. Setting it to `nil` disables paragraph filling. If filling is used, the fill column is controlled by the variable `vm-fill-long-lines-in-reply-column`.

Alternatively, you can fill individual paragraphs manually using `C-c C-q` (`mail-fill-yanked-message`).

#### Alternative methods to include text ¶

The method of MIME decoding for included text is relatively new in VM. The older methods are the inclusion of plain text, due to Kyle Jones, and the inclusion of text from the Presentation buffer, due to Robert Fenk.

The Kyle Jones method of plain text inclusion is enabled by setting the variable `vm-include-text-basic` to `t`. Setting the variable to nil returns you to the default behaviour. You can set the variable `vm-included-mime-types-list` to additional MIME type/subtype pairs that should be included in cited text. But it may not produce good results because the handling of MIME types is not available in the basic text inclusion method.

The Robert Fenk method of text inclusion from the Presentation buffer is enabled by setting the variable `vm-include-text-from-presentation` to t. In this case, the text display from the Presentation buffer is copied verbatim as the quoted text.

#### Options ¶

The variable `vm-included-text-attribution-format` specifies the format for the attribution of the included text. The attribution is a line of text that tells who wrote the text that is to be included; it will be inserted before the included text. If non-`nil`, the value of `vm-included-text-attribution-format` should be a string format specification similar to `vm-summary-format`. See Summaries. A `nil` value causes the attribution to be omitted.

VM normally includes only the body text from the cited messages. If you wish, you can include also the message headers by customizing the variables `vm-included-text-headers` and `vm-included-text-discard-header-regexp`.

### 4.4 Forwarding Messages ¶

VM has four commands to forward messages: `z` (`vm-forward-message`), `Z` (`vm-forward-message-plain`), `@` (`vm-send-digest`) and `B` (`vm-resend-message`).

#### Forwarding ¶

Typing `z` (`vm-forward-message`) puts you into a VM Mail mode buffer just like `m`, except that the current message appears as the body of the message in the VM Mail mode buffer.

The forwarded message is encapsulated as specified by the variable `vm-forwarding-digest-type`. Recognized values are `nil`, "mime", "rfc934" and "rfc1153". The default is "mime".

If `vm-forwarding-digest-type` is set to `nil`, the forwarded message is not encapsulated. It is included in a plain text form. Any attachments of the original message appear as attachment buttons in the composition. They will be replaced by actual attachments when the message is sent.

The key `Z` (`vm-forward-message-plain`) allows you to use plain-text forwarding directly, without needing to alter `vm-forwarding-digest-type`.

You can control which header lines are included in forwarded messages via the variables `vm-forwarded-headers` and `vm-unforwarded-header-regexp` (and their counterparts `vm-forwarded-headers-plain` and `vm-unforwarded-header-regexp-plain` for plain-text forwarding). How they are used differs based on the form of forwarding used.

- For encapsulated forwarding, the default is to forward all the headers, but you can limit the forwarded headers by setting `vm-unforwarded-header-regexp` to a regular expression. All the headers matching the regular expression will be omitted. If this variable is set to `nil`, then its value is ignored and only the headers listed in `vm-forwarded-headers` are forwarded.
- For plain-text forwarding, done by the `Z` command, the variables `vm-forwarded-headers-plain` and `vm-unforwarded-header-regexp-plain` are used in a similar way. If the latter is set to a regular expression, then the headers matching it are omitted. Otherwise, only the headers listed in `vm-forwarded-headers-plain` are included. The default settings forward only the headers “From”, “To”, “Cc”, “Subject”, “Date” and “In-Reply-To”.

The command `vm-forward-message-all-headers` forwards the message with all headers intact, irrespective of the values of these variables.

If the variable `vm-forwarding-subject-format` is non-`nil` it should specify the format of the Subject header of the forwarded message. A `nil` value causes the Subject header to be left blank. The forwarded message is flagged “forwarded” when the message is sent.

#### Digests ¶

The command `@` (`vm-send-digest`) works like `z` except that a digest of all the messages in the current folder is made and inserted into the VM Mail mode buffer. Also, `vm-send-digest` can be applied to just marked messages. See Marking Messages. When applied to marked messages, `vm-send-digest` will only bundle marked messages, as opposed to the usual bundling of all messages in the current folder. The message encapsulation method is specified by the variable `vm-digest-send-type`, which accepts the same values as `vm-forwarding-digest-type`. All the messages included in the digest will be flagged “forwarded” when the digest message is sent.

If you give `vm-send-digest` a prefix argument, VM will insert a list of preamble lines at the beginning of the digest, one line per digestified message. The variable `vm-digest-preamble-format` determines the format of the preamble lines. If the value of `vm-digest-center-preamble` is non-`nil`, the preamble lines will be centered.

#### Resending ¶

You can forward a message “as is”, without appearing to intervene, by resending it. Use the `B` (`vm-resend-message`) command. VM will resend the same original message and with its original headers and add a ‘`Resent-To`’ header that you should fill in with the new recipients. Use `C-c C-c` as usual to send the message. The resent message will be flagged as “redistributed”. Note that a re-sent message will appear to the recipients as if it came from the original sender. They will notice that you have re-sent the message only if they are careful to look for the `Resent-To` header. If they reply to the message, the reply will go to the original sender. This behavior can be confusing to many users and, so, should be used with caution.

### 4.5 Saving copies of sent mail ¶

You can save copies of outgoing mail messages in ’sent’ folders by adding an ‘`FCC:`’ header line to the composed message. The value of the header should be either the full path name of a mail folder on the file system or the maildrop specification of a folder on an IMAP server. If you use IMAP folders for saving sent mail, you should also add the function `vm-imap-save-composition` to the mail-mode’s `mail-send-hook` variable.

If you have multiple IMAP accounts, you might wish to save copies of your replies separately in each IMAP account. This can be done by adding an ‘`IMAP-FCC:`’ header line. The value of the header field should be a plain folder name on the “current” IMAP account, e.g., ‘Sent’. The “current” IMAP account will be determined by the IMAP folder from which you start composing the new message (which is called the “parent folder” for you composition). If the parent folder is not an IMAP folder or if there is no parent folder, then the message copy will be saved in a folder on `vm-imap-default-account`.

The variable `vm-do-fcc-before-mime-encode` allows you save the fcc copy to the sent folder before mime-encoding the message. This is useful if you want to save an unencrypted version of the message or avoid saving attachments. However, the character coding of the sent folder should be chosen carefully to allow proper storage of the messages.