### Mailutils Help Command Example Source: https://mailutils.org/manual/html_section/mailutils.html Demonstrates how to get help for a specific mailutils command. This is equivalent to using the --help option with that command. ```bash mailutils help ldflags ``` -------------------------------- ### MDA Configuration for Mailing Lists Source: https://mailutils.org/manual/mailutils.html Example MDA configuration showing SQL interface setup for user database retrieval. ```ini auth { authorization (sql, system); authentication (generic, system); } sql { interface mysql; db mail; getpwnam "SELECT user as name, mailbox, \ 'x' as passwd, 500 as uid, 2 as gid, \ '/nonexistent' as dir, '/sbin/nologin' as shell \ FROM userdb \ WHERE user='${user}'"; } ``` -------------------------------- ### Example Authorization Module List Source: https://mailutils.org/manual/html_node/auth-statement.html Defines the order in which authorization modules are tried. This example shows searching system, then SQL, then virtual domain databases. ```plaintext (system, sql, virtdomains) ``` -------------------------------- ### Example of Custom Headline Format with Date Formatting Source: https://mailutils.org/manual/html_section/mail.html An example demonstrating how to set a custom headline format string that includes a fixed-width message number and a custom-formatted date. ```mail configuration example set headline="%4m %20D{%Y-%m-%dT%H:%M:%S}" ``` -------------------------------- ### MDA Configuration for Mailing List Source: https://mailutils.org/manual/html_chapter/Programs.html Example MDA configuration showing SQL interface setup for user authentication, which is a prerequisite for the userdb table entries that implement mailing lists. ```mda auth { authorization (sql, system); authentication (generic, system); } sql { interface mysql; db mail; getpwnam "SELECT user as name, mailbox, \" x\" as passwd, 500 as uid, 2 as gid, \" \"/nonexistent\" as dir, '/sbin/nologin' as shell \" FROM userdb \" WHERE user='${user}'"; } ``` -------------------------------- ### Example Mailbox Mode Configuration Source: https://mailutils.org/manual/html_node/Namespace.html Demonstrates how to set read and write permissions for the group within a namespace. ```text mailbox-mode g=rw; ``` -------------------------------- ### Sieve Conditional Logic Example Source: https://mailutils.org/manual/html_section/Syntax.html An example demonstrating the use of 'if', 'elsif', and 'else' with 'header' tests and 'discard' or 'fileinto' actions. ```Sieve if header :contains "from" "coyote" { discard; } elsif header :contains ["subject"] ["$$$"] { discard; } else { fileinto "INBOX"; } ``` -------------------------------- ### Configure comsatd via inetd Source: https://mailutils.org/manual/html_section/comsatd.html The server can be started from /etc/inetd.conf. This is the default operation mode. ```bash comsat dgram udp wait root /usr/sbin/comsatd \ comsatd -c /etc/comsat.conf ``` -------------------------------- ### Mailutils Configuration File Example Source: https://mailutils.org/manual/html_node/Paths.html Illustrates a basic Mailutils configuration structure with nested blocks and statements. ```mailutils foo { bar { baz 45; # A. } baz 98; # B. } ``` -------------------------------- ### Detailed Verbose Configuration Parsing Source: https://mailutils.org/manual/html_node/configuration.html Example output with increased verbosity, showing each parsed configuration statement and its location. ```text imap4d: parsing file `/etc/mailutils.conf' # 1 "/etc/mailutils.conf" mailbox { # 2 "/etc/mailutils.conf" mailbox-pattern maildir:/var/spool/mail;type=index;param=2;user=${user}; # 3 "/etc/mailutils.conf" mailbox-type maildir; }; ``` -------------------------------- ### Example DBM Quota Database Source: https://mailutils.org/manual/html_node/DBM-Quotas.html This example demonstrates the structure and content of a DBM quota database file. It shows how to set default quotas, unlimited quotas, and specific quotas for users, including size units like 'mb'. ```text # Default quota value: DEFAULT 5mb # Following users have unlimited mailbox size root NONE smith NONE # Rest of users plog 26214400 karin 10mB ``` -------------------------------- ### Putmail Local Delivery Example Source: https://mailutils.org/manual/mailutils.html Example of using the putmail utility to deliver mail to a local mailbox. ```bash putmail /var/spool/mail/test ``` -------------------------------- ### Example Mailutils Ticket File Source: https://mailutils.org/manual/html_node/mailutils-wicket.html This is an example of the content found in a Mailutils ticket file, used for matching URLs. ```text smtp://foo:bar@* smtp://bar:baz@gnu.org *://baz:qux@* *://quux:bar@gnu.org ``` -------------------------------- ### Here-Document Example Source: https://mailutils.org/manual/html_section/configuration.html Demonstrates the use of a here-document to include multiline strings in a configuration. ```plaintext < ``` -------------------------------- ### Display Help Summary Source: https://mailutils.org/manual/html_node/Common-Options.html Use this option to display a short summary of command-line options and their descriptions. The output includes a usage synopsis, an option summary, and bug reporting information. ```bash Usage: sieve [OPTION...] SCRIPT GNU sieve -- a mail filtering tool ``` ```bash -c, --compile-only Compile script and exit -d, --debug[=FLAGS] Debug flags -e, --email=ADDRESS Override user email address ``` -------------------------------- ### Example Local Mailbox URL Source: https://mailutils.org/manual/html_chapter/Mailbox.html An example of a URL identifying a local mailbox using the 'mbox' type. ```text mbox:///var/spool/mail/gray ``` -------------------------------- ### Create a new database Source: https://mailutils.org/manual/html_node/Create-a-Database.html Use the 'create' subcommand to initialize a new database file. The database file will be truncated if it already exists. ```bash mailutils dbm create file.db ``` -------------------------------- ### Create a database from standard input Source: https://mailutils.org/manual/html_node/Create-a-Database.html Populate the database with data read from standard input. Each line in the input should contain a key and a value separated by whitespace. ```bash mailutils dbm create file.db < input.txt ``` -------------------------------- ### Block Statement Example Source: https://mailutils.org/manual/html_section/configuration.html Provides an example of a block statement, which groups a sequence of statements within curly braces. ```plaintext server srv1 { host 10.0.0.1; community "foo"; } ``` -------------------------------- ### Example Help Output Excerpt Source: https://mailutils.org/manual/html_chapter/Usage-Vars.html An excerpt from the 'sieve --help' output showing the format of options within a group: short option, long options, and description. ```text -c, --compile-only Compile script and exit -d, --debug[=FLAGS] Debug flags -e, --email=ADDRESS Override user email address ``` -------------------------------- ### Multiline String with Comment Example Source: https://mailutils.org/manual/mailutils.html Shows a multiline string where comments and whitespace appear between 'text:' and the newline. Within the string itself, hash signs lose their special meaning and are treated literally. ```mailutils text: # This is a comment Sample text # This line is taken verbatim /* And this line too */ . ``` -------------------------------- ### List Server Capabilities Source: https://mailutils.org/manual/html_chapter/Programs.html Requests and displays the server's capabilities. ```bash smtp command: **capa** _[ name...]_ ``` -------------------------------- ### Python Mail Filter Example Source: https://mailutils.org/manual/mailutils.html A sample Python script demonstrating a mail filter. It checks for specific headers and sender patterns to process and append messages to a designated mailbox. ```python from mailutils import * import maidag import re msg = message.Message (maidag.message) hdr = msg.header try: if 'List-Post' in hdr and 'Received' in hdr \ and hdr['Received'].find ('fencepost.gnu.org') != -1: # check envelope's sender address m = re.search (r'([\w\-]+)-bounces\+([\w]+)=.*', msg.envelope.get_sender ()) if m: lbox = m.group (1) user = m.group (2) # open destination mailbox and append message dst = mailbox.MailboxDefault ('~/Mail/%s' % lbox) dst.open ('ac') dst.append_message (msg) dst.close () # set deleted flag so maidag will not deliver msg elsewhere msg.attribute.set_deleted () except Exception: pass ``` -------------------------------- ### List all mailutils help options Source: https://mailutils.org/manual/html_node/mailutils-help.html Use the 'mailutils help' command to display a list of all available options and command names with their descriptions. ```bash mailutils help ``` -------------------------------- ### RADIUS Attribute Assignment Example Source: https://mailutils.org/manual/html_node/radius-statement.html Example of an attribute-value pair assignment for a RADIUS request, showing symbolic attribute names and values. ```radius-config "Service-Type = Authenticate-Only, NAS-Identifier = \"mail\"" ``` -------------------------------- ### Specifying a Configuration File with --file Source: https://mailutils.org/manual/html_node/mailutils-query.html Use the --file or -f option to specify an alternative configuration file instead of the default main configuration file. ```bash $ mailutils query --file /usr/local/etc/file.conf .pidfile ``` -------------------------------- ### Example: Recipient Check in Format Source: https://mailutils.org/manual/html_node/Format-String-Diffs.html Example showing how to use the 'rcpt' function to check for the presence of a 'to' recipient in a format string. ```mh-format %(lit)%<(rcpt to)%(formataddr{to})%> ``` -------------------------------- ### Get Core Mailutils Linker Flags Source: https://mailutils.org/manual/html_node/mailutils-ldflags.html Use this command without arguments to get the linker flags for the core Mailutils library. ```bash $ mailutils ldflags -L/usr/local/lib -lmailutils ``` -------------------------------- ### IMAP LIST Command Example for Other Namespace Source: https://mailutils.org/manual/html_node/Namespace.html An example IMAP LIST command that would trigger the expansion of $user in the 'other' namespace configuration. ```imap 1 LIST "~smith" "%" ``` -------------------------------- ### Example: Sending a Message with mailutils Source: https://mailutils.org/manual/html_node/mailutils-send.html Demonstrates how to send a message from a file named 'input.msg' using the SMTP service on 'localhost'. ```bash $ mailutils send localhost input.msg ``` -------------------------------- ### Customizing Headline Format in Mailutils Source: https://mailutils.org/manual/mailutils.html Sets a custom format string for the mailutils header summary. This example demonstrates using various format specifiers like message number, sender, date, lines, octets, and subject. ```shell set headline "%>%a %4m %18f %16d %3l/%-5o %s" ``` -------------------------------- ### Create Database from Input File Source: https://mailutils.org/manual/html_chapter/Programs.html Redirect data from a file to standard input for database creation. Alternatively, use the --file option. ```bash mailutils dbm create file.db < input.txt ``` ```bash mailutils dbm create --file input.txt file.db ``` -------------------------------- ### Example of dup-args=true Source: https://mailutils.org/manual/html_chapter/Usage-Vars.html When `dup-args` is true, arguments for an option are shown with both short and long options, even if the option has both forms. This example illustrates the output. ```shell -e ADDRESS, --email=ADDRESS Override user email address ``` -------------------------------- ### Create a database using the --file option Source: https://mailutils.org/manual/html_node/Create-a-Database.html The --file option provides an alternative to input redirection for specifying the input data file. This command is equivalent to using input redirection. ```bash mailutils dbm create --file input.txt file.db ``` -------------------------------- ### Starting Mail with Empty Mailbox Source: https://mailutils.org/manual/html_node/Mail-Variables.html If 'emptystart' is set, mail will start even if the mailbox is empty, overriding the default behavior of exiting immediately. ```mail mail: _boolean_ **emptystart** ¶ Default: False ``` -------------------------------- ### Example comsatd test mode execution Source: https://mailutils.org/manual/html_chapter/Programs.html Demonstrates how to run comsatd in test mode with a mailbox and message QID. The optional file argument specifies an output log file. ```bash $ comsatd --test /var/mail/root 34589 ``` ```bash $ comsatd --test=logfile /var/mail/root 34589 ``` ```bash $ comsatd -tlogfile /var/mail/root 34589 ``` -------------------------------- ### Formatting Date in Mailutils Headline Source: https://mailutils.org/manual/mailutils.html Configures the date format within the mailutils headline using the %D specifier, which accepts a strftime format string. This example sets a ISO 8601-like format for the date. ```shell set headline="%4m %20D{%Y-%m-%dT%H:%M:%S}" ``` -------------------------------- ### Mailutils Debug Level Syntax Example Source: https://mailutils.org/manual/html_chapter/Programs.html An example of specifying debug levels for a category, enabling all levels except trace9, trace0, trace1, and trace2. ```mailutils acl.prot,!=trace9,!trace2 ``` -------------------------------- ### MHL traditional notation for ignores keyword Source: https://mailutils.org/manual/mailutils.html This is the traditional notation equivalent to the quoted 'ignores' keyword example in MHL, where multiple values are listed on separate lines or with appropriate separators. ```mhl leftadjust,compwidth=9 ignores=msgid,message-id,received ``` -------------------------------- ### List specific database entries by key Source: https://mailutils.org/manual/html_node/List-the-Database.html Provide specific keys as arguments after the database file to list only records matching those keys. This example shows listing records for 'foo' and 'bar'. ```bash $ mailutils dbm list file.db foo bar foo 1 bar 56 ``` -------------------------------- ### MDA DBM Quota Database Example Source: https://mailutils.org/manual/html_section/mda.html An example of a quota database in text format for mda, specifying default and user-specific mailbox size limits. ```text # Default quota value: DEFAULT 5mb ``` -------------------------------- ### Sieve Script for Purging Expired Mail Source: https://mailutils.org/manual/mailutils.html A Sieve script to purge messages based on an 'X-Expire-Timestamp' header. This is an alternative to pop3d's delete-expired option and requires manual cron job setup. ```sieve require "timestamp"; # Replace "5" with the desired expiration period if timestamp :before "X-Expire-Timestamp" "now - 5 days" { discard; } ``` -------------------------------- ### Verbose Configuration Parsing Output Source: https://mailutils.org/manual/html_node/configuration.html Example output when using the --config-verbose option to show parsing of configuration files. ```text imap4d: parsing file `/etc/mailutils.conf' imap4d: finished parsing file `/etc/mailutils.conf' ``` -------------------------------- ### Example: Reply Regex Configuration Source: https://mailutils.org/manual/html_node/Format-String-Diffs.html Example of setting a POSIX extended regular expression for identifying reply messages, accounting for different language prefixes. ```mh-format %(reply_regex ^\(re|aw|ang|odp\)\[[0-9]+\]?:[[:blank:]]) ``` -------------------------------- ### Show Configuration Options Source: https://mailutils.org/manual/html_node/Common-Options.html Use this option to display configuration options used during package compilation. This helps verify if specific features or mailbox format support are included in the binary. ```bash --show-config-options ``` -------------------------------- ### Example of comma-separated level specifications Source: https://mailutils.org/manual/html_node/Level-Syntax.html This example demonstrates how to enable multiple levels within a category while excluding specific ones using a comma-separated list. ```plaintext acl.prot,!=trace9,!trace2 ``` -------------------------------- ### Debug authentication and authorization with user data Source: https://mailutils.org/manual/html_section/debugging.html This example shows the output format for the 'auth' category at 'trace0' level, reporting user data and their source. It includes details like username, UID, GID, and directory. ```text pop3d: source=system, name=gray, passwd=x, uid=120, gid=100, gecos=Sergey Poznyakoff, dir=/home/gray, shell=/bin/bash, mailbox=/var/mail/gray, quota=0, change_uid=1 ``` -------------------------------- ### Example of dup-args=false Source: https://mailutils.org/manual/html_chapter/Usage-Vars.html When `dup-args` is false, arguments for an option are only shown with the long option if both short and long forms exist. This example shows the output format. ```shell -e, --email=ADDRESS Override user email address ```