Mailutils smtp

From Mailutils

Jump to: navigation, search

The mailutils smtp command invokes an interactive SMTP client shell. It reads commands from the standard input, executes them and displays the results on the standard output. If the standard input is connected to a terminal, the readline and history facilities are enabled (provided that Mailutils is configured with GNU Readline).


Initializing connection

connect [-tls] hostname [port]
Connect to SMTP server at hostname (IP address or host name). If the -tls option is given, TLS encryption (also known as SMTPS protocol) will be used. Default port number is 25 for plain SMTP and 465 for SMTPS. Explicit port argument overrides the default value.

Connection parameters

A number of parameters is associated with an open connection:

Domain name used in EHLO statement. Defaults to the current host name.

The following parameters are used for ESMTP authentication:

User name.
User password.
GSASL service name.
Realm name.
Host name
SMTP URL. It can contain all of the above. Default is smtp://

These parameters are manipulated using the following statements:

set param value [param value...]
Set parameter param to value. Several parameters can be set with one set statement.
clear [param...]
Unset named connection parameters. If used without arguments, unsets all parameters.
list [param...]
List connection parameters. If used without arguments, lists all parameters.

SMTP commands

ehlo [domain]

Send the ESMTP greeting. Unless domain is supplied, the connection parameter domain is used.

capa [name...]

List the server capabilities.


Initiate encrypted connection. This command is disabled if the connection is opened with the -tls option.

auth mech [mech...]



Reset the session state

from [email]

Sets sender email address. Used without arguments, prints the sender email address.

to [email]

Sets recipient email address. Used without arguments, prints all recepient names collected so far.

smtp command [args...]

Send command with arguments verbatim.

Quits the SMTP session.
send [file]

Read the message from file and send it. If file is not supplied, the action depends on whether a send command was used prevously within the same session. If so, mailutils will first ask whether to reuse already supplied message. If not, it will start an editor, allowing you to enter the message. When you exit from the editor, you will be prompted on what to do with the message: send, edit, or quit (discard) it.

Internal commands

verbose [on|off|mask|unmask] [secure [payload]]
Control output verbosity. See the detailed description here.
prompt string
Set command prompt. See the detailed description here.
Exit the program.
help [command]
Without arguments displays a list of commands with possible arguments and short descriptions.
With one argument, displays a terse description for the given command.
? [command]
A synonym for help.
Shows command history.

See also

Personal tools