# Using &kmail;

## The Main Window

The main window is the window that appears when &kmail; is started. It is divided into three panes:

Folders pane (left pane)

- This pane contains the list of your message folders (other email programs may call them mailboxes). To select a folder, simply click on it. The messages contained in the folder will now appear in the Headers pane. The folder list can be displayed in both a short view, which takes up only a small portion of the left side of the screen, and a long view, which takes up the entire left side of the screen but is able to show more mailboxes. You can toggle between these two views under Appearance/Layout in the Settings Configure &kmail;... dialog. Also see the Folders Section for more information about how to use folders.

Headers pane (upper right pane)

- This pane lists header information (message Status Flags, Sender, Subject, Date, optionally Size) for the messages in the currently selected folder. Clicking on a header will select that message and display it in the Message pane. You can also select more than one message by holding down the &Ctrl; key when clicking on messages. You may sort the messages by clicking on the column that you wish to sort. If you click on the same column more than once, sort order will toggle between ascending/descending.

Message pane (lower right pane)

- This pane displays the currently selected message. Attachments appear at the bottom of the message, either as icons or embedded in the message, depending on View Attachments. You can scroll through the message page by page using the Page Up and Page down keys, or line by line using the up arrow and down arrow keys. You can also use key shortcuts to skip through your messages without having to use the mouse.

## Keyboard Shortcuts

The following keyboard shortcuts are supported in the main window:

Keyboard Shortcut | Action
Space | Scroll down in the current message or go to the next unread message if you are already at the bottom.
Right Arrow or N | Go to the next message in the current folder.
Left Arrow key or P | Go to the previous message in the current folder.
+ | Go to the next unread message in the current folder.
- | Go to the previous unread message in the current folder.
&Ctrl;+ | Go to the next folder with unread messages.
&Ctrl;- | Go to the previous folder with unread messages.
&Ctrl;Left Arrow | Walk upwards in the list of folders. Use &Ctrl;Space to actually enter the folder.
&Ctrl;Right Arrow | Walk downwards in the list of folders. Use &Ctrl;Space to actually enter the folder.
&Ctrl;Space | Enter the folder that has focus, &ie; the folder that you navigated to using &Ctrl;Left Arrow or &Ctrl;Right Arrow.
&Shift;Left Arrow and &Shift;Right Arrow | Select messages in the header pane, starting with the current message.

## The Composer Window

The composer window is used to write new messages. It can be invoked via Message New Message... menu or from the New Message icon on the main window.

### Composing a Message

To write your message, fill in the appropriate fields in the composer window. Use the View menu to select which header fields are displayed. The Identity field offers a Sticky option. If it is checked, the current identity will become the default identity when you open a new composer next time.

There are a variety of shortcuts to help you with writing your messages. The ... buttons next to the To:, CC:, and BCC: fields will call up the address book so that you can select addresses from there.

When you start typing an address in the To:/CC:/BCC: fields, a popup will appear that offers matching addresses that have been used recently and matching addresses from your address book. If you do not like the automatic popup you can disable it by clicking with the &RMB; on the field and choosing a different completion mode.

Whenever you want to add more than one recipient in one of the fields, use a comma to separate each address from the next one. You may need to specify fully qualified addresses (&ie; `user@domain.com`) even for local users, depending on your system configuration.

When you are finished with your message, click the Send icon (the envelope) to send the message now, or click the Queue icon to put the message in the outbox. If your message is not finished yet, select Message Save in Drafts Folder. If you want to send an encrypted or digitally signed message, select the Sign Message resp. Encrypt Message icons in the toolbar.

If you have installed and activated at least one of the encryption plugins then you can select whether you want to use the built-in OpenPGP support or the plugin for encryption and/or signing. Use the built-in OpenPGP support if you want to send clearsigned messages or inline encrypted messages. If you want to send signed or encrypted messages with attachments you should use one of the crypto plugins. Please note that the built-in OpenPGP will not sign or encrypt attachments.

### Adding Attachments

You can attach files to your message by using one of the methods below:

- Click the Attach File (paper clip) icon and select the file you wish to attach.

- Drag a file from the desktop or another folder into the composer window.

- Select one of the options in the Attach menu.

Once a file is attached to your message, it appears in the attachments pane at the bottom of the composer window. You can use the &RMB; on each attachment to View, Save or Remove the attachment.

Use the Properties... item to open the Message Part Properties dialog. The first field contains the attachment's &MIME;-type. Just like the Name field, it should be automatically filled with an appropriate value. Sometimes the &MIME;-type value may be wrong. You can then type in any &MIME;-type or choose from the list of common &MIME;-types. You can also select an encoding method for your file from the list of encoding options (normally, the default value works fine). Check the Suggest automatic display option if you want to suggest to the recipient the automatic (inline) display of this part in the message preview, instead of the default icon view.

PGP/GnuPG keys may also be attached to your message by using the appropriate options in the Attach menu. PGP key attachments are handled like file attachments.

Attachments will not be encrypted if you are using the built-in OpenPGP support. To encrypt attachments, you have to install and configure encryption plugins.

### Checking the Spelling of your Message

To check the spelling of your message, select Tools Spelling.... &kmail; uses &kspell; to check spelling, which is the &kde; frontend to the ispell or aspell spelling checker. Note that you may first need to configure the spellchecker using Settings Spellchecker....

## Message Folders

Message Folders are used to organize your email messages. By default, all message folders are stored in the folder `Mail`, which is created in your home folder. When you first start &kmail; the inbox, outbox, sent-mail, trash and drafts folders are created. These folders each have special functions:

inbox:

- Where &kmail; by default puts your new messages when you ask it to check your mail.

outbox:

- Where messages are put while they are waiting to be delivered. Note that you should not drag and drop messages here to send them, use the Send icon in the composer window instead.

sent-mail:

- Contains copies of all messages that you have sent.

trash:

- Contains all messages that you have moved to trash.

drafts:

- Contains messages you started to edit but then saved to this folder instead of sending them.

You may find that the standard folders are fine for your needs. Eventually, though, you will probably need folders to help you organize your messages. To create a new folder, select Folder New Folder... The folder properties dialog will then prompt you for the necessary information. If you ever need to change the settings for a folder, select the folder you wish to modify in the Folders pane and select Folder Properties... .

To move messages from one folder into another, select the message(s) you want to move and press the M key or select Message Move To. A list of folders will appear. Select the folder from the list that you want to move the messages to. Messages can also be moved by dragging them from the Headers pane into the Folders pane.

If you want to clear all of the messages out of a folder choose Folder Move All Message to Trash. You can use Folder Delete Folder to remove a folder and all its messages and subfolders.

### Folder Properties

The folder's Properties dialog lets you rename and move a folder and specify all of its properties. Note that most properties are only available for your own folders and not for default folder like inbox &etc;. Default folders also cannot be moved or renamed.

You can make a folder a subfolder if you choose a parent folder using the Belongs to selection.

The Folder Icons section lets you choose icons that are different from the default ones in the folder list.

See the Folder Format section for information about the Mailbox format.

If you're going to use the folder for a mailing list you may want to add the mailing list address in the Associated Mailing List section. You will then be able to use the Message Reply to Mailing-List... menu item. It will open a reply with the mailing list address in the To: field (&ie; it will ignore the Reply-To of the message). You can also click the middle mousebutton in the Folders pane to post to a mailing list that is associated with that folder.

The Old Message Expiry section lets you automatically delete old messages when you exit &kmail; (depending on your settings in &kmail;'s Folders configuration page) or via File Expire All Folders.

Messages that are expired are deleted. They are not moved to trash, so be careful with this setting.

With the Identity section you can set your default identity for new messages. Replies to messages that where sent directly to you will still default to the message's To address if an according identity is found.

With Show Sender/Receiver you can set the visible columns in the header pane. This is useful if you use a folder to save your own sent messages.

### Folder Format

A message folder can be either in mbox or in maildir format. mbox saves all messages of a folder to one file, whereas maildir saves each message to its own file. maildir, which is the default format, can be considered more robust, but it can be slower on some file systems. If you are unsure, you should choose maildir.

Note that there is currently no feature in &kmail; that allows to convert between both formats automatically - but you can just move all messages from an old mbox folder to a new maildir folder or vice versa.

## Message Filters

After using &kmail; for a while, you may find that you have trouble sorting out the new messages in your inbox when they arrive. Filters allow you to automatically perform certain actions on incoming messages and to manually perform actions on selected messages in a folder.

Please note that the filters described in this section are applied after the messages have been downloaded from your account. If you want to filter messages on the server, see Download Filters.

Filters consist of a search pattern, whose rules are used as criteria to determine whether this filter should be applied to a given message, and a list of filter actions, which describe what is being done with or to the message if the search pattern matches. Read more about search patterns and filter actions in the following subsections.

Filters are considered one after the other, starting with the first filter in the list. The first one whose pattern matches the given message gets executed. You can request that the remaining filters also be applied, but the default is to stop processing at the first matching filter.

Usually, filters are used on incoming messages, but they can also be applied to sent messages or to an arbitrary message or group of messages. To selectively filter messages, select the messages you want to filter in the message list and type &Ctrl;J or select Message Apply Filters. This will apply all filters that have been marked for manual filtering in the filter dialog to those messages.

### Fast Filter Creation

There are two methods for creating a filter: The quick method is to use Tools Create Filter.... This will call the filter dialog and present you with a new filter which has the first rule of the search pattern and the first action (as file into folder) preset. In most cases, all you have to do is select the folder where the message should be moved to. But you can, of course, edit the filter as you like.

The interesting thing about this method is that creating a filter on mailing lists will try really hard to find a criterion that uniquely identifies messages from that list. If it succeeds, the guessed name of the list is presented in the Tools Create Filter Filter on Mailing-List... menu entry.

The second method is to manually construct a filter from scratch by calling the filter dialog through Settings Configure Filters.... The filter dialog is described in detail in the following subsection.

### The Filter Dialog

This dialog allows you to manage and edit your list of filters.

You reach it either via Tools Create Filter... or Settings Configure Filters....

The dialog is divided into four main sections:

Available Filters

- This group contains the list of filters and some action buttons to modify the filters, namely to create new filters, to move them up or down the list, or to delete or rename them. If you select a filter from the list, its properties are shown in the right-hand half of the dialog.

Filter Criteria

- In this group you can edit the pattern that messages must match for the filter to be applied to them. You can select here whether all of the defined rules must match or whether it suffices that any one of them matches. See Search Patterns below for a detailed description of each search rule type.

  You can click on More to get an additional (initially empty) rule if you want to define more complex patterns and on Fewer to remove the last rule. Clear clears the pattern, &ie; it removes all but two rules from screen and resets those two.

  Invalid or empty rules are not evaluated.

Filter Actions

- In this group you can edit the list of actions that is applied to all messages that match the defined search pattern. See Filter Actions below for a detailed description of each action type.

  You can click on More to get a new, empty action if you want to define more than one action and on Fewer to remove the last action. Clear clears the list, &ie; it removes all but one action and resets that one.

  Invalid or empty actions are not executed.

Advanced Options

- In this group you can define a few advanced options for filters that allow you to refine your filtering.

  Using the first row of check boxes, you can toggle the applicability of the corresponding filter: The to incoming messages check shows whether it may be considered for incoming messages (&ie; on Check Mail). The to sent messages check shows the same for sent messages (&ie; after Send) and the on manual filtering check controls whether to apply this filter when filtering manually (&ie; via Message Apply Filters).

Filters are automatically named unless you explicitly rename them using the Rename... button. The dialog assumes that it should continue auto-naming the filter as long as the filter name starts with <.

If you apply filter changes, via OK or Apply, only valid filters are actually copied to the internal filter manager.

A filter is considered invalid if

1. the search pattern contains only empty rules or

2. the action list is empty.

Similarly, empty rules and actions are removed from the pattern and action list respectively, before the filter is saved.

### Search Patterns

The most common use of filters is to filter on the sender of messages. This can be done by choosing From. A good bet for a mailing list would be <recipients>. But there are other criteria a filter can search for. Note that all patterns are interpreted case-insensitively:

<message>

- Searches the whole message (&ie; headers, body and attachments, if any).

<body>

- Searches the body of the message.

<any header>

- Searches the headers of the message.

<recipients>

- Searches the To and CC header fields of the message.

<size in bytes>

- Sets upper or lower bounds on the message size.

<age in days>

- Sets upper or lower bounds on the message age.

Any other name

- Searches the header field that is given by that name.

### Filter Action

The most common use of filters is to sort incoming messages to certain folders. This can be done by choosing move to folder. Here is a list of all possible actions:

file into folder

- This will file the message into another folder, removing it from it's current folder if necessary. You currently cannot use IMAP folders as a target.

set identity to

- This will set your identity if you reply to this message.

mark as

- This allows you to mark the message as read or important (flagged), but also as forwarded, replied, &etc;

set transport to

- This will set the method of transport (⪚ SMTP) if you reply to the message.

set Reply-To to

- Will modify the Reply-To field of this message. This can be useful for mailing lists that automatically set a Reply-To which you do not like.

forward to

- Will forward the message to another email address.

redirect to

- Will redirect the message to another email address.

bounce

- Will try to return the message to the sender as undeliverable.

  This will only work if the senders email address is valid. That is not the case for most spam messages.

confirm delivery

- Will try to return a message to the sender that indicates successful delivery of his message, if he requested that.

  This action allows you to select who will get delivery receipts from you. Though you can globally enable the sending of delivery confirmations in the Configure &kmail;... dialog (Security page) we recommended to not send them to everyone, since this makes tracking of ⪚ spam messages very easy for the sender.

execute command

- This will execute a program, but will not modify the message. Specify the full path to the program you want to execute. &kmail; will block until the program returns. You can feed the program with the parts of the mail: %0, %1, &etc; will stand for files representing the message parts. For common messages %0 is the text, %1 the first attachment and so on. Additionally, the whole message is fed into the program's stdin. In addition, every occurrence of %{foo} is replaced by the content of the foo header.

  This currently only works if the message has at least one attachment. No, not even %0 will work in the general case!

  You can enter arbitrarily complex shell commands here, since &kmail; uses a sub shell to execute the command line. Therefore, even this command will work (within its limits): ``uudecode` `-o` `$(mktemp kmail-uudecoded.XXXXXX)` && `echo` `$'\a'``

pipe through

- This will feed the message to a program. If that program returns output, the entire message (including the headers) will be replaced with this output. If the program does not return output or exits with a return code that's not 0, the message will not change. Specify the full path to the program. The same substitutions (%n, %{foo} as with execute command are performed on the command line.

  Be cautious with this action, as it will easily mess up your messages if the filter program does return garbage or extra lines.

remove header

- Will remove all header fields with the given name from the message. This is useful mainly for removing bogus Reply-To: headers.

add header

- If no such field is already present, will add a new header field with the given name and value to the message. If there is already a header field with that name, it is overwritten with the new (the given) value. If there are already multiple headers with the given name (⪚ Received: headers), an arbitrary one of them is overwritten and the others are left unchanged. This is a known limitation. You may want to combine this filter with the remove header filter above to make sure that there are no other headers with that name in the message.

rewrite header

- Will scan the given header field, modify its contents and write it back. The search string is always interpreted as a case-sensitive regular expression. The replacement string is inserted literally except for occurrences of `\n`, `$n` and `${nn}`, where `n` is a positive (single-digit, except for the third form) number or `0`. These constructs are interpreted as back references to substrings captured with parentheses in the search string.

  Analogous restrictions as in the add header action apply here, too.

### Filter Examples

If I am subscribed to the (general) &kde; List, I could create a folder for the list (I will call it `KDE-General`) and use a filter to automatically transfer new messages from my inbox to my `KDE-General` folder if they are from the &kde; List. Here is how to create this filter:

### Filtering a mailing list

1. Try if Tools Create filter Filter on Mailing-List... can identify the mailing list (the name of the list should then appear in the menu item). In this case, this works and I am presented a filter that has X-Mailing-List equals <kde@lists.netcentral.net> preset. You select the desired destination folder from the folder pull-down menu in the Filter Action group and that's it!

   If that does not work, think of a unique way of identifying the messages you want to filter. The (almost) unique property of my &kde; List messages is that they always contain kde@lists.netcentral.net in the To: or CC: field. It is only almost unique, because this fails for cross-posted messages.

2. Select Settings Configure Filters....

3. Press the New button to create an empty filter. It will appear as <unknown>.

4. In the Filter Criteria area, select <recipients> from the first pull-down menu, contains from the second pull-down menu, and type `kde@lists.netcentral.net` in the text field.

5. Skip down to the Filter Actions section. Select move to folder from the first pull-down menu. A new pull-down menu containing a list of folders will appear. Select the folder that you want the filtered messages to be transferred to. For this example, you would select KDE-General from the pull-down menu.

You may find that you need to use more powerful criteria to properly filter your messages. For example, you may only want to filter the &kde; List messages that are written by your friend `Fred Johnson <fj@anywhere.com>`. This is where the rest of the matching criteria section comes into play:

### Extending the filter

1. Open up the Configure Filters... window and select the filter you just created.

2. Since you want to filter all messages that have `kde@lists.netcentral.net` in the To: or CC: field and that are from Fred, check the Match all of the following radio button.

3. Now, go to the second search rule and select the following from the pull-down menus: From, contains. Now, type `fj@anywhere.com` in the text field.

You now have a filter that transfers all &kde; List messages that are from `fj@anywhere.com`.

## Download Filters

Download Filters can be used to filter mails from a POP server, before they are completely downloaded. You can use it to prevent &kmail; from downloading huge mails and save time this way.

In the configuration dialog of the POP account you can enable download filtering by checking the Filter messages if they are greater than box. Once you did that, you can specify a size which is used as a threshold. Messages exceeding this size will be checked against the filter rules you defined. If no filter rule matches, they will be shown in a confirmation dialog and you can decide what to do with them. The default size for filtering is 50,000 Bytes. This is a good value as the overhead is kept to a minimum. Every message that is looked at by the filter causes additional traffic because the header of the message is downloaded twice. The default action is Download mail to prevent the loss of messages.

Be careful with the Delete mail from server option since once a mail is deleted on the server there is no way to get it back.

With a really good set of filter rules, it is possible that all messages that exceed the threshold size are automatically tagged (&ie; downloaded, kept on the server or deleted) and you would never be bugged by the confirmation dialog. Be careful though, since once a message is matched by a filter rule, you have no guarantee that you can change the action before it is executed. Only if there is a message left that was not matched by a filter rule the confirmation dialog will show up.

### The Configure Pop Filter Dialog

Adding filter rules works similar as for message filters. On the left hand side you can manage the existing filters. Use the New button to add a filter. On the right hand side you can configure under which conditions the current filter should match. Using Filter Action you specify what will happen to a message that is matched by this rule. The available options are:

Download mail

- Will download the messages matched by the filter, just as any other message that does not exceed the threshold size.

Download mail later

- Will tag the messages for later download. This means the messages matched will stay on the POP server until you choose to download them by changing the action manually.

Delete mail from server

- Will delete the message from the server and does not download it. Once you deleted a message from the server, there is no way you can undo this. Be careful, as rules could match messages you actually want, too.

The option Always show matched 'Download Later' messages in confirmation dialog will cause the confirmation dialog to show up during mailbox check if at least one message was tagged for Download Later - even if all messages exceeding the threshold size were matched by a rule. This option is useful in the case you have messages matched by a rule and tagged for Download Later, but you do not get any message exceeding the size limit for a very long time. Without this option, the confirmation dialog would never show up and you would never have a chance to get the queued message by changing the action manually.

### The Confirmation Dialog

This dialog shows up whenever you have POP filtering switched on and messages were found on the server that exceed the threshold size you defined for the POP account. Now you have the chance to decide what you want to do with that message. The options are Download (green), Download later (yellow with egg watch) and Delete from server (red X). Be cautious with the delete option, since once you deleted a mail from the server, there is no way to undelete it again.

In the Filtered Messages section you can check the box if you got messages that were automatically tagged for a certain action (download, download later, delete) by a filter rule. The checkbox is only enabled if you got some messages that were matched by a filter rule. Once you check it, a list similar to the one for the not automatically tagged messages will show up and you can change the action for every single message.

Please note that if there is a message exceeding the size limit, but all messages are matched by a filter rule the dialog will not show up. One exception occurs if you have checked Always show matched 'Download Later' messages in the Global Options section of the POP filter configuration dialog. Then the dialog will also show up if you only have matched messages, but at least one got tagged for Download later.

## Using Multiple Accounts

Multiple accounts are used to check for messages from more than one email address and/or mail server. Select Settings Configure &kmail;... and click on the Network page to add or change your account settings. See the Getting started section for more information on the settings in the Network page.

To check for messages from a particular account, use the File Check Mail In submenu to select the account to check for mail. You can also press the mouse button on the Check Mail icon for some time to get a list of accounts.

## Signing and Encrypting Messages with PGP or GnuPG

This is a short introduction on how to setup &kmail;'s PGP (Pretty Good Privacy) support. It will give some hints on the use of PGP too. It is written for people who are beginners in this area. If you are familiar with the use of PGP, you can skip most of the steps. This documentation (and the &kmail; user interface) generally talks only about PGP, but it applies to both PGP and GnuPG (GNU Privacy Guard), although some GnuPG command line parameters may be different.

Please also check out the &FAQ; item about PGP.

Attachments will not be encrypted if you are using the built-in OpenPGP support. To encrypt attachments, you have to install and configure encryption plugins. Then you can decide for each attachment if it should be encrypted or not.

&kmail; has to rely on PGP's output. This output is often different between different versions of PGP, so it is important that you test if encryption really works with your setup before you start using it seriously. &kmail; might not warn you if something fails. You better enable Show signed/encrypted text after composing.

To setup and use PGP support in &kmail; it is necessary to have PGP installed and set up properly. Of course we cannot give you a full introduction of PGP here. We will only mention the steps you have to do to get PGP going. For details you should have a look at the excellent PGP documentation or The GNU Privacy Handbook.

It is certainly a good idea to study this documentation as well as an introduction into public key cryptography (⪚ out of the PGP 6.5.x package). There you can learn a lot about the basic concepts, which will help you to understand what is going on. As well, many security related issues you should know about are discussed there.

Now let's start.

### Preconditions

&kmail; expects that your PGP binary is called `pgp`. In case of GnuPG, it expects the binary to be called `gpg`. If that is not the case for you, just make a symlink.

If you have not done so, you have to generate a key pair (secret and public key) for your identity. You must do this at the command line: use ``pgp` `-kg`` resp. ``gpg` `--gen-key``. &kmail; has no internal support for pgp's key generation at this time. The identity (normally your name followed by your email address within brackets, such as `John Doe <john@example.com>`) and your passphrase are important for the co-operation between &kmail; and PGP.

### PGP Related Settings in &kmail;

Select the OpenPGP tab on the Security settings page. There you will find the following options:

Encryption tool

- Here you can choose if you want to use PGP, GnuPG or no encryption software at all. Of course the program you select has to be installed on your system. It is also important to select the correct version.

Keep passphrase in memory

- When this option is off, &kmail; will ask for your passphrase each time you sign a message (before sending) or select an encrypted message. If you turn this option on, &kmail; will remember your passphrase from after your first successful input until you finish your &kmail; session. The passphrase is stored in memory and not written to the hard disk. If you use one of the Crypto-Plugins or if you use GnuPG with the gpg-agent then an external program will ask for your passphrase and optionally remember it for some time.

Always encrypt to self

- If this option is off and you want to send an encrypted message to somebody, then you cannot read this message any longer after you have composed and encrypted it. Turn this option on to keep sent encrypted messages readable for you too.

Show signed/encrypted text after composing

- This will show you the result of encrypting and signing before the message gets sent. This way you can still cancel sending if encrypting failed. It is strongly recommended to use this option.

Always show the encryption keys for approval

- This will always open a dialog that lets you choose the keys used for each recipient when you are sending an encrypted message. If this option is off, &kmail; will show this dialog only when it cannot find a key for a recipient or when there are conflicting or unset encryption preferences.

Automatically sign messages using OpenPGP

- This lets you toggle whether to automatically sign your messages by default. Of course it is still possible to send unsigned messages by deselecting the icon in the composer window.

Automatically encrypt messages whenever possible

- If this option is on, &kmail; will automatically encrypt messages with the built-in OpenPGP support or the PGP/MIME-Plugin provided that for every recipient a trusted PGP key is found in your keyring and provided that you did not tell &kmail; not to encrypt messages send to certain recipients. If in doubt &kmail; will ask whether the message should be encrypted or not.

Now that you have setup the encryption tool you have tell &kmail; which OpenPGP key you want to use for signing and for encrypting messages. To do this go to the Identities configuration and set the key that should be used on the Advanced tab of the identity configuration.

Now you are able to sign outgoing messages. To let people send you encrypted messages and to let them verify your signature you must send them your public key or upload your public key to a public PGP key server so that they can fetch your key from there. To send encrypted messages to other people or to verify their signed messages you will need their public keys. You can store your public key(s) on a public PGP key server such as http://www.cam.ac.uk.pgp.net/pgpnet/.

### Sign your Messages

You compose your message as usual in the composer window of &kmail;. Before you send the message, check the Sign Message icon on the toolbar of the composer window. Then, you can send the message. The identity you are using to write the current message needs to be connected to an OpenPGP Key in the Identity section of the Configure dialog. To sign the message, &kmail; needs to know your PGP passphrase. If you did not select Keep passphrase in memory in the Security section, &kmail; will ask you for it. On the other hand, if you have already given the phrase to &kmail;, it will sign the message without any further prompt.

### Encrypt your Messages

To send an encrypted message to somebody of whom you have a public key, you simply create the message in the composer window. Before you send the message, check the Encrypt Message button in the toolbar of the composer window. Note that you might not have to check the button if Automatically encrypt messages whenever possible is selected in &kmail;'s configuration (see above). Then send the message.

If you checked the Encrypt Message button and &kmail; cannot find a matching key for a recipient, it will display a list containing all available keys in the Encryption Key Selection dialog. If &kmail; finds more than one trusted key for a recipient, it will display a list containing all matching keys for this recipient. In both cases you can select the key(s) which should be used for encrypting this message for the recipient in question. Using the Remember choice checkbox you can save your selection for future messages.

If you are using a key for the first time or if there are conflicting Encryption Preferences or if Always show the encryption keys for approval is selected in the Security section of &kmail;'s configuration dialog, the Encryption Key Approval dialog will appear. Here you can select different keys for the recipients and you can also set the Encryption Preference for each recipient. The default option, Encrypt whenever encryption is possible, will automatically encrypt your message if there is a trusted key for each recipient.

As mentioned above, you will not be able to read your own encrypted sent messages if you do not check Always encrypt to self in the settings' Security page.

### Send your Public Key

Prepare a message to the person you want to send your public key to. Then choose in the composer window's menu Attach Attach My Public Key. This will attach the public key you defined for the current identity to the message. Now you can send the message.

Remember that it is not safe at all if you sign the message to make sure that the receiver will get the correct key. There can be a man-in-the-middle attack, as somebody can change the key and sign the message with that other key. That is why the recipient should verify the attached key by checking the key's fingerprint against the one he got in a secure way from you. Have a look at the PGP documentation for further details.

### You got an encrypted Message

All you have to do is to select the message in &kmail;. You will be prompted for your passphrase. Then &kmail; will try to decrypt the message and show you the plain text if the message had been encrypted with your public key. (If not, then you will not be able to read it.) &kmail; stores the messages encrypted, so nobody can read these messages without knowing your passphrase.

### Receiving a Public Key

You can receive a public key as an attachment or via http, ftp or a floppy. Before you can use this key to encrypt a message to the owner of the key, you should verify the key (check its fingerprint or look for trusted signatures). Then you can add this key to your public keyring by typing ``pgp` `-ka` `filename`` at the command line if you are using PGP or by typing ``gpg` `--import` `filename`` at the command line if you are using GnuPG. If the key is not certified with a trusted signature you cannot use it to encrypt messages unless you have signed the key with your key.

## Section Authors

This section written by: Daniel Naber daniel.naber@t-online.de and David Rugge davidrugge@mediaone.net.