# Hidden Preferences

Some preferences are not available in any of the panes of the Preferences window. They can only be accessed using the Terminal application and thus require some technical skills. There are various reasons for keeping these preferences hidden. Some have just not been added to a Preferences pane yet, but most of them are used to enable experimental features which cannot yet be considered stable or complete features.

Most of the hidden preferences are configured using the `defaults` command. Note that you can also use this command to read and delete a hidden preference. Here are examples with the `MmDefaultBccHeader` setting:

    defaults read com.freron.MailMate MmDefaultBccHeader
    defaults delete com.freron.MailMate MmDefaultBccHeader

You must relaunch MailMate after changing anything using the `defaults` command.

## Visual Appearance

Note that font settings can be handled via the “Format ▸ Show Fonts” menu item. You need to focus the part of the interface that you would like to change.

You can change the maximum number of email addresses shown in the headers view (the default is 30):

    defaults write com.freron.MailMate MmHeadersViewMaximum -integer 10

Dock icon counters size is configurable as follows (default size is 24.0):

    defaults write com.freron.MailMate MmDockCounterFontSize -float 48.0

It's possible to make MailMate collapse quoted text beyond a certain quoting level. Instead a line with “Show/Hide quoted text” appears. Navigation is possible using the tab and space keys. Here is an example of using the currently hidden preference:

    defaults write com.freron.MailMate MmShowQuotedTextLimit -integer 2

This should hide quote levels of level 3 or more. This currently also works for HTML messages, but there might be undesired side effects. Feedback is welcome.

It's possible to force MailMate to always display attachments at the top of the message display. This is a stop-gap solution until better handling of attachments has been implemented:

    defaults write com.freron.MailMate MmShowAttachmentsFirst -bool YES

The “QuickLook” and “Save” buttons on an attachment can be moved to the left side of an attachment line:

    defaults write com.freron.MailMate MmAttachmentButtonsOnLeft -bool YES

Earlier versions of MailMate had an almost text-only style. If you prefer this then it's still available using this hidden preference:

    defaults write com.freron.MailMate MmUseOldToolbar -bool YES

The “Prefer Plain Text” option in the Viewer preferences pane is not quite what some users are looking for. The following preference ensures that HTML is never displayed -- not even if the email does not contain any alternative.

    defaults write com.freron.MailMate MmNeverDisplayHTML -bool YES

The following is a quick hack for users wanting the “SOURCES” above the “MAILBOXES” section in the mailbox outline:

    defaults write com.freron.MailMate MmSourcesAboveMailboxes -bool YES

A regular expression can be defined to override image blocking settings:

    defaults write com.freron.MailMate MmAllowedImageURLRegexp -string "https://(freron\.com|example\.com)/.*"

## Navigation

When moving or deleting a message MailMate automatically selects the “next” message in the current mailbox. The definition of “next” can be controlled using the following preference:

    defaults write com.freron.MailMate MmMessagesOutlineMoveStrategy -string "next"

The possible values are:

Value | Behavior
--- | ---
`none` | Do not select another message.
`next` | Select the next message with respect to the sorting direction.
`previous` | Select the previous message with respect to the sorting direction.
`unreadOrNext` | Always prefer the direction of an unread message before going to `next`.
`unreadOrPrevious` | Always prefer the direction of an unread message before going to `previous`.

When following an external link then MailMate can be told to use a specific browser instead of the global default (configurable in Safari). The application identifier is needed for this. Here is an example telling MailMate to use “Google Chrome”:

    defaults write com.freron.MailMate OakBrowserAppBundleIdentifier -string "com.google.Chrome"

Some users prefer the single message window to close after, e.g., archiving. This can be done by enabling this preference:

    defaults write com.freron.MailMate MmSingleMessageWindowClosesAfterMove -bool YES

On earlier releases of OS X it was common that a vertical drag in a list could be used to select multiple lines. A horizontal drag was required to initiate a drag action. The following preference enables the old behavior in the message list:

    defaults write com.freron.MailMate MmMessagesOutlineVerticalDragSelects -bool YES

Under certain circumstances, MailMate tries to keep messages in the currently displayed mailbox even if they no longer strictly belong to that mailbox. This happens, for example, when marking a message read in the default “Unread” mailbox. This is likely what most users would prefer, but it can be disabled as follows:

    defaults write com.freron.MailMate MmStickyMessagesEnabled -bool NO

Alternatively, the user can setup a key binding for the `refreshMailbox:` selector.

## Searching

The “Edit ▸ Find ▸ Mailbox Search” defaults to searching the “From” header of all messages. The syntax is not well documented, but this behavior can be overridden as follows:

    defaults write MmDefaultMailboxSearchFilter -string "subject.body ~ ''"

(Ideally, the GUI should allow the user to save the current search as the default.)

## Composing

The following can be used to add a BCC (blind carbon copy) header by default to all outgoing messages:

    defaults write com.freron.MailMate MmDefaultBccHeader -string me@example.com

Using the special value `"<.sender.>"` tells MailMate to use the sending address of the related account.

MailMate uses delivery headers such as `X-Original-To` in order to derive an appropriate From address for replies. This is especially powerful when used in combination with the “Address Pattern” in the IMAP account settings, but some users may want to make MailMate pick the first address in “Email Address(es)” whenever none of the addresses are explicitly used in the recipient fields (`To` or `Cc`). This can currently be done by setting the following preferences:

    defaults write com.freron.MailMate MmIgnoreDeliveryAddresses -bool YES

An experimental alternative algorithm for the dynamic signatures system exists. It can be configured using the Terminal as follows:

    defaults write com.freron.MailMate MmDynamicSignatureMethod -string messageType

The three possible values are `none` (to disable it completely), `standard` (the default behavior), and `messageType`. The last one bases its signature guess on whether the message is new or is a reply. The intention is to be able to use a detailed signature for new messages and a short signature for replies — automatically.

The composer allows you to enable/disable various headers in the headers menu (far left of the status bar in the composer window). The list of available headers can be augmented as follows:

    defaults write com.freron.MailMate MmAdditionalComposerHeaders "( { headerName = 'X-Priority'; defaultValue = '1'; type = 'plain'; } )"

In this example, an `X-Priority` header is made available. Giving it a value of 1 is going to make the message a high priority message (at least according to some email clients). Note that this is a really low-level feature. Make sure you know what you are doing before adding non-standard headers to outgoing messages.

Finally, it is possible to customize the generated “On ... John Appleseed wrote:” string for replies. This can be done as follows:

    defaults write com.freron.MailMate MmReplyWroteString -string 'On %e %b %Y, at %k:%M, ${from.name:${from.address}} wrote:'

The placeholders for date and time are the same as described in the manual page for the `strftime` function. The following describes this function in the Terminal if you have Xcode installed:

    man strftime

Otherwise, it's available here.

MailMate uses the plain text body part of an email when generating the quoted text for a reply. Unfortunately some email clients (including Gmail) hard-wrap the plain text body part. As an experimental workaround, MailMate can be told to try to unwrap the plain text body part before creating the reply. Feedback is welcome:

    defaults write com.freron.MailMate MmAutomaticUnwrapEnabled -bool YES

Some users prefer to always have the initial focus in the text editor of the Composer window, also for new messages:

    defaults write com.freron.MailMate MmComposerInitialFocus -string "alwaysTextView"

Some users prefer to disable automatic derivation of the sender address when forwarding an email:

    defaults write com.freron.MailMate MmForwardingDeriveIdentityFromRecipient -bool NO

Some users prefer attachments to never be inlined:

    defaults write com.freron.MailMate MmNeverInlineAttachments -bool YES

Notifications show a “Reply” button which behaves just like the reply button in the main window. It's possible to replace this behavior with an inline reply which is then sent without opening a window:

    defaults write com.freron.MailMate MmNotificationInlineReply -bool YES

Alternatively, it's possible to replace the button with a “Delete” button:

    defaults write com.freron.MailMate MmNotificationDeleteButtonEnabled -bool YES

The recipient text fields in the Composer display at most 6 lines by default. This can be changed as follows:

    defaults write com.freron.MailMate MmComposerMaximumNumberOfRecipientLines -integer 10

You might prefer that if you often send to a large number of recipients. If you do then please remember to use the `Bcc:` header instead of the `To:` or `Cc:` headers.

MailMate supports using external editors to write emails. This is done by enabling the corresponding bundle in the Bundles preferences pane and then use the `⌃⇧O` shortcut to edit the currently open draft. It is also possible to trigger this automatically when using tab to move into the main text field of the Composer. This is enabled as follows:

    defaults write com.freron.MailMate MmBundleCommandLaunchedOnTab "46C1F8A8-A069-4E54-A427-30D45342674F"

The `UUID` argument is a bit tricky to find. Here are the values needed for the bundles currently available.

Editor | UUID
--- | ---
Atom | `18C8A279-7953-4E52-84D3-DE5F4F2C6E10`
BBEdit | `4382C559-76C1-4950-BD10-33A1EBCA9B5D`
MacVim | `5A2D62AF-4725-492B-BFC6-DAB411D1AA86`
TextMate | `46C1F8A8-A069-4E54-A427-30D45342674F`

### Retired Email Addresses

If you have one or more email addresses which you no longer use for sending emails then you might face the following problem: After receiving an email sent to such an address then you would like to reply to it using a different email address. This won't work if you have listed the email address in one of your accounts, but if you have not listed it then MailMate is going to put the address in the “Cc” field (if you reply to all).

You can work around this problem by explicitly telling MailMate that it's a retired email address. Quit MailMate and edit the following file:

    ~/Library/Application Support/MailMate/Identities.plist

Add a line like this to the related account:

    retiredAddressPattern = "retired@example\\.com";

The pattern uses the same format as the “Address Pattern” in the IMAP account settings window.

### Hardcoded CSS

The default themes for generated HTML does not include a specific font, but simply states that it should be `sans-serif`. This should work well for most purposes. If you need to experiment with setting a specific font (or other CSS changes) then you can do it using the `MmDefaultCSS` hidden preference:

    defaults write com.freron.MailMate MmDefaultCSS -string 'body { font-family: "Helvetica Neue", Helvetica, sans-serif; }'

This is strongly discouraged, but let me know if and why you have to use this hidden preference.

### LDAP

MailMate supports searching LDAP servers when autocompleting names/addresses in the composer window, but there is currently no GUI for this feature. It has only been tested with very few LDAP servers and feedback on success/failure of this feature is welcome.

To use this feature you need to create a file named `LDAP.plist` in the following folder: `~/Library/Application Support/MailMate/`. Here is an example with SSL disabled (which is necessary for some badly configured servers):

    {   servers = (
            {   requireSSL = 0;
                hostname = "ldap.example.com";
                // port = ...;
                // username = "...";
                // searchBase = "";
                // searchScope = "subtree"; // base, oneLevel, or subtree (default)
            },
        );
    }

If a `username` is provided then MailMate looks for a password in the keychain. It can be added manually to the keychain, but it should also work if Apple Mail has been used to store the password.

## IMAP

There's a hidden preference available to launch MailMate in an offline state for all accounts:

    defaults write com.freron.MailMate MmInitialOfflineStateEnabled -bool YES

Also note the `toggleOnlineStateOfAllAccounts:` key binding for toggling online state.

## Sending

Based on this discussion, it is now possible to store a sent message with the message to which it is a reply:

    defaults write com.freron.MailMate MmMoveSentRepliesToMailboxOfRepliedMessage -bool YES

The above currently does not work well with address completion since only “Sent Messages” is used as a history of previously sent messages. This can be changed using the following hidden preference:

    defaults write com.freron.MailMate MmAddressCompletionMailbox -string 8F9C1062-E4F8-4949-B5DC-BAB7CDEC4110

The same can be done with the following preference which completely changes what is shown in the “Sent Messages” standard mailbox. This is convenient if sent messages are not kept in dedicated mailboxes:

    defaults write com.freron.MailMate MmSentMailbox -string 8F9C1062-E4F8-4949-B5DC-BAB7CDEC4110

The value given should be the UUID of a mailbox. The UUID can be copied to the pasteboard using “Edit ▸ Copy” after selecting a mailbox.

This is all experimental and how it works may change slightly before becoming a GUI feature.

Some users might prefer that an offline IMAP account also means that messages are not sent using the corresponding SMTP server. For now, this can be done by enabling the following preference:

    defaults write com.freron.MailMate MmDoNotSendFromOfflineAccounts -bool YES

Some users prefer that the `X-Mailer` header is not added to outgoing emails:

    defaults write com.freron.MailMate MmStripXMailerBeforeSending -bool YES

This doesn't mean that it's not possible to see that the emails were generated by MailMate. For example, MIME boundary strings still contain “MailMate”. Note that the header is removed just before sending. This means that the copy saved in “Sent Messages” would still include the header (exceptions might occur if/when the server saves its own copy of sent messages).

### Alternative SMTP server

This is a functional but somewhat incomplete feature allowing you to select an alternative SMTP server in the Composer. It is described in more detail in this mailing list post.

    defaults write com.freron.MailMate MmSMTPAlternativeEnabled -bool YES

### Internationalized Email

MailMate has experimental support for the use of the `SMTPUTF8` SMTP extension. In short, this means that MailMate can generate and send emails with UTF8 headers. This also means that MailMate supports international user and domain names in email addresses. This feature is naturally limited by what is supported by the transmission agents, IMAP servers, and receiving email clients.

    defaults write com.freron.MailMate MmSMTPUTF8Enabled -bool YES

Don't enable this if you don't really know what you are doing. Review your outgoing messages (`⌥⌘U`) and make sure both server and recipients can handle it. Feedback is welcome on how well this feature works in practice.

Note that you need an SMTP server with support for `SMTPUTF8`. This currently includes Gmail and the latest releases of Postfix.

### Custom message verifications

Before MailMate sends a message then the message is verified in various ways, for example, it is verified that a subject exists.

It is possible to create some simple custom verifications as well. This is done by creating a file in the current location:

    ~/Library/Application Support/MailMate/Resources/messageVerifications.plist

Here is an example which checks that the message contains at least one tag with a `@`:

    {
        verifications = (
            {
                title = "Message not tagged";
                details = "You have not tagged the message. Are you sure you want to send it?";
                conditions = "#flags !~ '@'";
            }
        );
    }

### Delayed sending

MailMate has a “Send Later” feature, but it has to be set on a message by message basis.

You can set a default delay for all outgoing messages by modifying the `MmSendMessageDelayEnabled` and `MmSendMessageDelay` hidden preferences.

You have to turn default delay on:

    defaults write com.freron.MailMate MmSendMessageDelayEnabled -bool YES

And then set the delay duration (in seconds):

    defaults write com.freron.MailMate MmSendMessageDelay -integer 180

The command above sets a delay of 3 minutes.

Once this feature is enabled, you can cancel sending a message by selecting it in the Drafts folder and using “Message ▸ Cancel Send and Edit” (`⌥⇧⌘D`).

### Warn about external recipients

MailMate warns about sending to external recipients if a regular expression pattern is provided for internal recipients. A simple example:

    defaults write com.freron.MailMate MmInternalRecipients -string "@freron\.com"

Anything not sent to `@freron.com` addresses is then going to trigger a warning.

A more fine-grained alternative is also available. This requires quitting MailMate and then editing the following file:

    ~/Library/Application Support/MailMate/Identities.plist

The following is an example which tells MailMate which addresses are to be considered internal for a given identity. Anything not sent to an address at `freron.com` is going to trigger a warning when trying to send:

    internalAddressPattern = ".*@freron\\.com";
    internalAddressPatternEnabled = 1;

By default the pattern is interpreted as being case insensitive.

### Fixed IP

A few users may want to hardcode the IP used for the EHLO SMTP command:

    defaults write com.freron.MailMate MmSMTPFixedIP -string "127.0.0.1"

Alternatively, a hostname can be fixed like this (in this case it's important to not use `MmSMTPFixedIP`):

    defaults write com.freron.MailMate MmSMTPFixedHostname -string "example.com"

## Sending PDFs

The following is a feature of OS X which is not obvious. You can add a menu item to the PDF menu of the Print dialogue which makes it easier to create a new message with a PDF attached. You just need to make an alias to the MailMate application in the following folder:

    ~/Library/PDF Services/

After making the alias, the name of the alias can be changed to, for example, “Mail PDF with MailMate.app”.

## Security

### Cross-message Content IDs

The so-called `cid:` URLs are supported by MailMate. They are mainly used for rich text (like HTML) to reference images included as attachments in the same message, but they are designed to also work even if referencing parts of other messages. If you do not want MailMate to resolve such references then you can use the following:

    defaults write com.freron.MailMate MmCrossMessageContentIDsAllowed -bool NO

### OpenPGP / S/MIME

Some users may have multiple keys/certificates for a single identity (email address). There is currently no GUI for mapping an email address to a specific key, but a low level solution is available. You need to create the following file:

    ~/Library/Application Support/MailMate/Security.plist

Example content:

    {
        map = (
            {
                address = "user1@example.com";
                userID = "0x70DC41A4D3A3CB12";
            },
            {
                address = "user2@example.com";
                userID = "0x70DC41A4D3A3CB12";
            },
            {
                address = "user3@example.com";
                serial = "34 29 1B DA 91 26 0A 8D 8E 61 AC FD 4D 1C 30 F1";
            },
        );
    }

The `userID` value is a value as described in the “HOW TO SPECIFY A USER ID” section of the man page for `gpg2`. You must restart MailMate for any changes to take effect. The `serial` value can be seen when displaying a certificate in Keychain Access.

If an empty string is provided for `userID` or `serial` then it's a hint to MailMate that signing/encryption is not used for this email address. This overrides whatever the setting is in the Security preferences pane. For OpenPGP the `address` can also be the address of a recipient.

## Network issues

For a long time MailMate has used the `OpenSSL` libraries for its network code. This changed with the release of version 1.9.5 and MailMate now uses Apple's `CFNetwork`. The old code still works though and can be enabled like this:

    defaults write com.freron.MailMate CFNetworkEnabled -bool NO

If you use this setting then please let me know why. If needed, it's also possible to enable `OpenSSL` for a single account (an undocumented feature).

## IMAP Namespaces

If you need access to non-private IMAP namespaces then try the following:

    defaults write com.freron.MailMate MmNonPrivateNamespacesEnabled -bool YES

Please report how this works for you (both good and bad).

Some users may need to specify an IMAP namespace prefix explicitly. A known example is UW IMAP servers which return a set of namespaces similar to the following:

    NAMESPACE (("" "/")("#mhinbox" NIL)("#mh/" "/")) (("~" "/")) (("#shared/" "/")("#ftp/" "/")("#news." ".")("#public/" "/"))

If MailMate uses the above as is then it is likely that all files in the home catalog of the user are fetched as IMAP mailboxes. This is a server configuration problem and it is obviously a serious security issue. Nevertheless, if you need to override the NAMESPACE response from the server then you can add the following line to the `Sources.plist` file in `~/Library/Application Support/MailMate`:

    namespaceResponse = '(("MailboxPrefix" "/")) NIL NIL';

You must replace `MailboxPrefix` with the name of the folder with your IMAP mailboxes.

IMAP and SMTP connections are kept alive for a while when they are not in use. The defaults are 120 and 30 seconds, but this can be configured in `Sources.plist` or `Submission.plist` using `keepAliveSeconds`. For example:

    keepAliveSeconds = 10;

## Performance

### Support for CONDSTORE

MailMate supports the CONDSTORE IMAP extension, but it can be disabled as follows:

    defaults write com.freron.MailMate MmEnableIMAPCondstore -bool NO

The CONDSTORE extension is supported by some IMAP servers and makes it faster to check IMAP mailboxes for changes since the last synchronization (in particular when there are no changes).

## Experimental dual mode

MailMate has a layout class for handling multiple modes in a window. This can be used to provide a dual-mode layout in which one can switch between list mode and message mode. To control it, a key binding is needed for `nextMode:`. To enable this layout, you need to do the following:

    mkdir -p ~/Library/Application\ Support/MailMate/Resources/Layouts/Mailboxes/
    cp /Applications/MailMate.app/Contents/Resources/Layouts/Mailboxes/dualMode.plist ~/Library/Application\ Support/MailMate/Resources/Layouts/Mailboxes/

And then edit `dualMode.plist` by removing the `enabled = 0` line.

## TNEF / winmail.dat

MailMate has built-in support for extracting anything hidden within the non-standard TNEF files generated by some email clients. These files are often named `winmail.dat` and they often contain the text body of the message in an alternative format (such as `rtf`). MailMate does not extract this by default, but you can force it to do so with this preference:

    defaults write com.freron.MailMate MmTNEFSaveBodies -bool YES

## Third party applications

A hidden preference has been introduced for BusyContacts users. It affects the behavior of the “Show” and “Add” menu items for email addresses in the headers view.

    defaults write com.freron.MailMate MmDefaultAddressBook -string com.busymac.busycontacts

## Debugging

When using the following debug variable, a log file is dumped to `/tmp/mailmate_imap_subscriptions.log` if an error occurs while fetching mailboxes to be displayed for “Edit Subscriptions”. It also enables logging for the Activity Viewer even when the Activity Viewer is closed.

    defaults write com.freron.MailMate LoggingEnabled -bool YES

Debug variable for logging any actions related to scripts:

    defaults write com.freron.MailMate MmDebugScripts -bool YES

Debug variable for logging communication between SpamSieve and MailMate:

    defaults write com.freron.MailMate DebugSpamDetection -bool YES

Debug variable for logging actions related to security protocols (S/MIME and OpenPGP):

    defaults write com.freron.MailMate MmDebugSecurity -bool YES

## Other

When dragging messages from the messages outline to the Finder (or Desktop), the default filename is based on the subject of the message. This can be customized using a format string. Here are some simple examples:

    defaults write com.freron.MailMate MmFilenameFormatString "${#body-part-id}.eml"
    defaults write com.freron.MailMate MmFilenameFormatString "${subject} (${from}).eml"

The default is a nicely formatted subject line: `${subject.prefix:+${subject.prefix} }${subject.blob:+[${subject.blob}] }${subject.body}.eml`. Note that due to a file system limitation, MailMate always replaces any occurrences of `:` with `;`.

Normal behavior when clicking the dock icon is to open a mailbox viewer if none exists. The following changes this behavior such that any existing message viewer windows or composer windows is taken to the front when the dock icon is clicked.

    defaults write com.freron.MailMate MmShowAnyViewerOnDockIconClick -bool YES

Trash and junk related mailboxes have an “Empty Mailbox...” menu item. This menu item can be enabled for all mailboxes like this:

    defaults write com.freron.MailMate MmEmptyMailboxMenuItemEnabled -bool YES