New Mail Feature

Execute a command upon the receipt of new mail.

1. Support

Since: NeoMutt 2016-07-23

Dependencies: None

2. Introduction

This feature enables the new_mail_command setting, which can be used to execute a custom script (e.g. a notification handler) upon receiving a new mail.

The command string can contain expandos, such as %n for the number of new messages. For a complete list, see: $status_format.

Note

When the notification is sent, the folder of the new mail is no longer known. This is a limitation of NeoMutt. The `%f` expando will show the open folder.

When using Maildir local mailboxes, you must set $check_new config variable for this feature to work.

For example in Linux you can use (most distributions already provide notify-send):

set new_mail_command="notify-send --icon='/home/santiago/Pictures/neomutt.png' \
'New Email' '%n new messages, %u unread.' &"

And in OS X you will need to install a command line interface for Notification Center, for example terminal-notifier:

set new_mail_command="terminal-notifier -title '%v' -subtitle 'New Mail' \
-message '%n new messages, %u unread.' -activate 'com.apple.Terminal'"

3. Variables

Table 27.1. New Mail Command Variables

Name Type Default
new_mail_command string (empty)

4. neomuttrc

# Example NeoMutt config file for the new-mail feature.

# --------------------------------------------------------------------------
# VARIABLES – shown with their default values
# --------------------------------------------------------------------------
# Set the command you want NeoMutt to execute upon the receipt of a new email
set new_mail_command = ""
# Linux example:
# set new_mail_command="notify-send --icon='/home/santiago/Pictures/neomutt.png' \
#   'New Email in %f' '%n new messages, %u unread.' &"
# OS X example:
# set new_mail_command="terminal-notifier -title '%v' -subtitle 'New Mail in %f' \
#   -message '%n new messages, %u unread.' -activate 'com.apple.Terminal'"
# --------------------------------------------------------------------------

# vim: syntax=neomuttrc

5. See Also

6. Known Bugs

None

7. Credits

Yoshiki Vazquez-Baeza, Santiago Torres-Arias, Richard Russon

Search by Algolia