sendmail

a Mail Transfer Agent

TLDR

Send a message with the content of message.txt to the mail directory of local user username

>_ sendmail [username] < [message.txt]
copy

Send an email from you@yourdomain.com (assuming the mail server is configured for this) to test@gmail.com containing the message in message.txt

>_ sendmail -f [you@yourdomain.com] [test@gmail.com] < [message.txt]
copy

Send an email from you@yourdomain.com (assuming the mail server is configured for this) to test@gmail.com containing the file file.zip

>_ sendmail -f [you@yourdomain.com] [test@gmail.com] < [file.zip]
copy

SYNOPSIS

exim4 [options] arguments ... mailq [options] arguments ... rsmtp [options] arguments ... rmail [options] arguments ... runq [options] arguments ... newaliases [options] arguments ...

DESCRIPTION

Exim is a mail transfer agent (MTA) developed at the University of Cam‐ bridge. It is a large program with very many facilities. For a full specification, see the reference manual. This man page contains only a description of the command line options. It has been automatically gen‐ erated from the reference manual source, hopefully without too much mangling. Like other MTAs, Exim replaces Sendmail, and is normally called by user agents (MUAs) using the path /usr/sbin/sendmail when they submit mes‐ sages for delivery (some operating systems use /usr/lib/sendmail). This path is normally set up as a symbolic link to the Exim binary. It may also be used by boot scripts to start the Exim daemon. Many of Exim's command line options are compatible with Sendmail so that it can act as a drop-in replacement.

DEFAULT ACTION

If no options are present that require a specific action (such as starting the daemon or a queue runner, testing an address, receiving a message in a specific format, or listing the queue), and there are no arguments on the command line, Exim outputs a brief message about it‐ self and exits. However, if there is at least one command line argument, -bm (accept a local message on the standard input, with the arguments specifying the recipients) is assumed. Thus, for example, if Exim is installed in /usr/sbin, you can send a message from the command line like this: /usr/sbin/exim4 -i CTRL-D The -i option prevents a line containing just a dot from terminating the message. Only an end-of-file (generated by typing CTRL-D if the in‐ put is from a terminal) does so.

SETTING OPTIONS BY PROGRAM NAME

If an Exim binary is called using one of the names listed in this sec‐ tion (typically via a symbolic link), certain options are assumed. mailq Behave as if the option -bp were present before any other op‐ tions. The -bp option requests a listing of the contents of the mail queue on the standard output. rsmtp Behaves as if the option -bS were present before any other op‐ tions, for compatibility with Smail. The -bS option is used for reading in a number of messages in batched SMTP format. rmail Behave as if the -i and -oee options were present before any other options, for compatibility with Smail. The name rmail is used as an interface by some UUCP systems. The -i option speci‐ fies that a dot on a line by itself does not terminate a non-SMTP message; -oee requests that errors detected in non-SMTP messages be reported by emailing the sender. runq Behave as if the option -q were present before any other op‐ tions, for compatibility with Smail. The -q option causes a sin‐ gle queue runner process to be started. It processes the queue once, then exits. newaliases Behave as if the option -bi were present before any other op‐ tions, for compatibility with Sendmail. This option is used for rebuilding Sendmail's alias file. Exim does not have the concept of a single alias file, but can be configured to run a specified command if called with the -bi option.

OPTIONS

-- This is a pseudo-option whose only purpose is to terminate the options and therefore to cause subsequent command line items to be treated as arguments rather than options, even if they begin with hyphens. --help This option causes Exim to output a few sentences stating what it is. The same output is generated if the Exim binary is called with no options and no arguments. --version This option is an alias for -bV and causes version informa‐ tion to be displayed. -Ac -Am These options are used by Sendmail for selecting configu‐ ration files and are ignored by Exim. -B This is a Sendmail option for selecting 7 or 8 bit process‐ ing. Exim is 8-bit clean; it ignores this option. -bd This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually the -bd option is combined with the -q

This option sets the address of the envelope sender of a lo‐ cally-generated message (also known as the return path). The option can normally be used only by a trusted user, but un‐ trusted_set_sender can be set to allow untrusted users to use it. Processes running as root or the Exim user are always trusted. Other trusted users are defined by the trusted_users or trusted_groups options. In the absence of -f, or if the caller is not trusted, the sender of a local message is set to the caller's login name at the default qualify domain. There is one exception to the restriction on the use of -f: an empty sender can be specified by any user, trusted or not, to create a message that can never provoke a bounce. An empty sender can be specified either as an empty string, or as a pair of angle brackets with nothing between them, as in these examples of shell commands: exim4 -f '<>' user@domain exim4 -f "" user@domain In addition, the use of -f is not restricted when testing a filter file with -bf or when testing or verifying addresses using the -bt or -bv options. Allowing untrusted users to change the sender address does not of itself make it possible to send anonymous mail. Exim still checks that the From: header refers to the local user, and if it does not, it adds a Sender: header, though this can be overridden by setting no_local_from_check. White space between -f and the
is optional (that is, they can be given as two arguments or one combined argu‐ ment). The sender of a locally-generated message can also be set (when permitted) by an initial "From " line in the mes‐ sage - see the description of -bm above - but if -f is also present, it overrides "From ". -G This option is equivalent to an ACL applying: control = suppress_local_fixups for every message received. Note that Sendmail will complain about such bad formatting, where Exim silently just does not fix it up. This may change in future. As this affects audit information, the caller must be a trusted user to use this option. -h This option is accepted for compatibility with Sendmail, but has no effect. (In Sendmail it overrides the "hop count" ob‐ tained by counting Received: headers.) -i This option, which has the same effect as -oi, specifies that a dot on a line by itself should not terminate an incoming, non-SMTP message. I can find no documentation for this option in Solaris 2.4 Sendmail, but the mailx command in Solaris 2.4 uses it. See also -ti. -L This option is equivalent to setting syslog_processname in the config file and setting log_file_path to syslog. Its use is restricted to administrators. The configuration file has to be read and parsed, to determine access rights, before this is set and takes effect, so early configuration file er‐ rors will not honour this flag. The tag should not be longer than 32 characters. -M ... This option requests Exim to run a delivery attempt on each message in turn. If any of the messages are frozen, they are automatically thawed before the delivery attempt. The set‐ tings of queue_domains, queue_smtp_domains, and hold_domains are ignored. Retry hints for any of the addresses are overridden - Exim tries to deliver even if the normal retry time has not yet been reached. This option requires the caller to be an admin user. However, there is an option called prod_requires_admin which can be set false to relax this restriction (and also the same requirement for the -q, -R, and -S options). The deliveries happen synchronously, that is, the original Exim process does not terminate until all the delivery at‐ tempts have finished. No output is produced unless there is a serious error. If you want to see what is happening, use the -v option as well, or inspect Exim's main log. -Mar
... This option requests Exim to add the addresses to the list of recipients of the message ("ar" for "add recipients"). The first argument must be a message id, and the remaining ones must be email addresses. However, if the message is active (in the middle of a delivery attempt), it is not altered. This option can be used only by an admin user. -MC This option is not intended for use by external callers. It is used internally by Exim to invoke another instance of it‐ self to deliver a waiting message using an existing SMTP con‐ nection, which is passed as the standard input. This must be the final option, and the caller must be root or the Exim user in order to use it. -MCA This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion. It signifies that the connection to the remote host has been authenticated. -MCD This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion. It signifies that the remote host supports the ESMTP DSN extension. -MCG This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion. It signifies that an alternate queue is used, named by the following argument. -MCK This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion. It signifies that a remote host supports the ESMTP CHUNKING extension. -MCP This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion. It signifies that the server to which Exim is connected supports pipelining. -MCQ This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC option when the original delivery was started by a queue runner. It passes on the process id of the queue runner, together with the file descriptor number of an open pipe. Closure of the pipe signals the final completion of the sequence of pro‐ cesses that are passing messages through the same SMTP con‐ nection. -MCS This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion, and passes on the fact that the SMTP SIZE option should be used on messages delivered down the existing connection. -MCT This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion, and passes on the fact that the host to which Exim is connected supports TLS encryption. -MCt This option is not intended for use by external callers. It is used internally by Exim in conjunction with the -MC op‐ tion, and passes on the fact that the connection is being proxied by a parent process for handling TLS encryption. The arguments give the local address and port being proxied, and the TLS cipher. -Mc ... This option requests Exim to run a delivery attempt on each message, in turn, but unlike the -M option, it does check for retry hints, and respects any that are found. This option is not very useful to external callers. It is provided mainly for internal use by Exim when it needs to re-invoke itself in order to regain root privilege for a delivery. However, -Mc can be useful when testing, in order to run a delivery that respects retry times and other options such as hold_domains that are overridden when -M is used. Such a delivery does not count as a queue run. If you want to run a specific delivery as if in a queue run, you should use -q with a message id ar‐ gument. A distinction between queue run deliveries and other deliveries is made in one or two places. -Mes
This option requests Exim to change the sender address in the message to the given address, which must be a fully qualified address or "<>" ("es" for "edit sender"). There must be ex‐ actly two arguments. The first argument must be a message id, and the second one an email address. However, if the message is active (in the middle of a delivery attempt), its status is not altered. This option can be used only by an admin user. -Mf ... This option requests Exim to mark each listed message as "frozen". This prevents any delivery attempts taking place until the message is "thawed", either manually or as a result of the auto_thaw configuration option. However, if any of the messages are active (in the middle of a delivery at‐ tempt), their status is not altered. This option can be used only by an admin user. -Mg ... This option requests Exim to give up trying to deliver the listed messages, including any that are frozen. However, if any of the messages are active, their status is not altered. For non-bounce messages, a delivery error message is sent to the sender, containing the text "cancelled by administrator". Bounce messages are just discarded. This option can be used only by an admin user. -Mmad ... This option requests Exim to mark all the recipient addresses in the messages as already delivered ("mad" for "mark all de‐ livered"). However, if any message is active (in the middle of a delivery attempt), its status is not altered. This op‐ tion can be used only by an admin user. -Mmd
... This option requests Exim to mark the given addresses as al‐ ready delivered ("md" for "mark delivered"). The first argu‐ ment must be a message id, and the remaining ones must be email addresses. These are matched to recipient addresses in the message in a case-sensitive manner. If the message is ac‐ tive (in the middle of a delivery attempt), its status is not altered. This option can be used only by an admin user. -Mrm ... This option requests Exim to remove the given messages from the queue. No bounce messages are sent; each message is sim‐ ply forgotten. However, if any of the messages are active, their status is not altered. This option can be used only by an admin user or by the user who originally caused the mes‐ sage to be placed in the queue. -Mset This option is useful only in conjunction with -be (that is, when testing string expansions). Exim loads the given message from its spool before doing the test expansions, thus setting message-specific variables such as $message_size and the header variables. The $recipients variable is made available. This feature is provided to make it easier to test expansions that make use of these variables. However, this option can be used only by an admin user. See also -bem. -Mt ... This option requests Exim to "thaw" any of the listed mes‐ sages that are "frozen", so that delivery attempts can re‐ sume. However, if any of the messages are active, their sta‐ tus is not altered. This option can be used only by an admin user. -Mvb This option causes the contents of the message body (-D) spool file to be written to the standard output. This option can be used only by an admin user. -Mvc This option causes a copy of the complete message (header lines plus body) to be written to the standard output in RFC 2822 format. This option can be used only by an admin user. -Mvh This option causes the contents of the message headers (-H) spool file to be written to the standard output. This option can be used only by an admin user. -Mvl This option causes the contents of the message log spool file to be written to the standard output. This option can be used only by an admin user. -m This is apparently a synonym for -om that is accepted by Sendmail, so Exim treats it that way too. -N This is a debugging option that inhibits delivery of a mes‐ sage at the transport level. It implies -v. Exim goes through many of the motions of delivery - it just doesn't actually transport the message, but instead behaves as if it had suc‐ cessfully done so. However, it does not make any updates to the retry database, and the log entries for deliveries are flagged with "*>" rather than "=>". Because -N discards any message to which it applies, only root or the Exim user are allowed to use it with -bd, -q, -R or -M. In other words, an ordinary user can use it only when supplying an incoming message to which it will apply. Al‐ though transportation never fails when -N is set, an address may be deferred because of a configuration problem on a transport, or a routing problem. Once -N has been used for a delivery attempt, it sticks to the message, and applies to any subsequent delivery attempts that may happen for that message. -n This option is interpreted by Sendmail to mean "no aliasing". For normal modes of operation, it is ignored by Exim. When combined with -bP it makes the output more terse (suppresses option names, environment values and config pretty printing). -O This option is interpreted by Sendmail to mean set option. It is ignored by Exim. -oA This option is used by Sendmail in conjunction with -bi to specify an alternative alias filename. Exim handles -bi dif‐ ferently; see the description above. -oB This is a debugging option which limits the maximum number of messages that can be delivered down one SMTP connection, overriding the value set in any smtp transport. If is omitted, the limit is set to 1. -odb This option applies to all modes in which Exim accepts incom‐ ing messages, including the listening daemon. It requests "background" delivery of such messages, which means that the accepting process automatically starts a delivery process for each message received, but does not wait for the delivery processes to finish. When all the messages have been received, the reception process exits, leaving the delivery processes to finish in their own time. The standard output and error streams are closed at the start of each delivery process. This is the default action if none of the -od options are present. If one of the queueing options in the configuration file (queue_only or queue_only_file, for example) is in effect, -odb overrides it if queue_only_override is set true, which is the default setting. If queue_only_override is set false, -odb has no effect. -odf This option requests "foreground" (synchronous) delivery when Exim has accepted a locally-generated message. (For the dae‐ mon it is exactly the same as -odb.) A delivery process is automatically started to deliver the message, and Exim waits for it to complete before proceeding. The original Exim reception process does not finish until the delivery process for the final message has ended. The stan‐ dard error stream is left open during deliveries. However, like -odb, this option has no effect if queue_only_override is false and one of the queueing options in the configuration file is in effect. If there is a temporary delivery error during foreground de‐ livery, the message is left in the queue for later delivery, and the original reception process exits. -odi This option is synonymous with -odf. It is provided for com‐ patibility with Sendmail. -odq This option applies to all modes in which Exim accepts incom‐ ing messages, including the listening daemon. It specifies that the accepting process should not automatically start a delivery process for each message received. Messages are placed in the queue, and remain there until a subsequent queue runner process encounters them. There are several con‐ figuration options (such as queue_only) that can be used to queue incoming messages under certain conditions. This option overrides all of them and also -odqs. It always forces queue‐ ing. -odqs This option is a hybrid between -odb/-odi and -odq. However, like -odb and -odi, this option has no effect if queue_only_override is false and one of the queueing options in the configuration file is in effect. When -odqs does operate, a delivery process is started for each incoming message, in the background by default, but in the foreground if -odi is also present. The recipient ad‐ dresses are routed, and local deliveries are done in the nor‐ mal way. However, if any SMTP deliveries are required, they are not done at this time, so the message remains in the queue until a subsequent queue runner process encounters it. Because routing was done, Exim knows which messages are wait‐ ing for which hosts, and so a number of messages for the same host can be sent in a single SMTP connection. The queue_smtp_domains configuration option has the same effect for specific domains. See also the -qq option. -oee If an error is detected while a non-SMTP message is being re‐ ceived (for example, a malformed address), the error is re‐ ported to the sender in a mail message. Provided this error message is successfully sent, the Exim receiving process exits with a return code of zero. If not, the return code is 2 if the problem is that the original mes‐ sage has no recipients, or 1 for any other error. This is the default -oex option if Exim is called as rmail. -oem This is the same as -oee, except that Exim always exits with a non-zero return code, whether or not the error message was successfully sent. This is the default -oex option, unless Exim is called as rmail. -oep If an error is detected while a non-SMTP message is being re‐ ceived, the error is reported by writing a message to the standard error file (stderr). The return code is 1 for all errors. -oeq This option is supported for compatibility with Sendmail, but has the same effect as -oep. -oew This option is supported for compatibility with Sendmail, but has the same effect as -oem. -oi This option, which has the same effect as -i, specifies that a dot on a line by itself should not terminate an incoming, non-SMTP message. Otherwise, a single dot does terminate, though Exim does no special processing for other lines that start with a dot. This option is set by default if Exim is called as rmail. See also -ti. -oitrue This option is treated as synonymous with -oi. -oMa A number of options starting with -oM can be used to set val‐ ues associated with remote hosts on locally-submitted mes‐ sages (that is, messages not received over TCP/IP). These op‐ tions can be used by any caller in conjunction with the -bh, -be, -bf, -bF, -bt, or -bv testing options. In other circum‐ stances, they are ignored unless the caller is trusted. The -oMa option sets the sender host address. This may in‐ clude a port number at the end, after a full stop (period). For example: exim4 -bs -oMa 10.9.8.7.1234 An alternative syntax is to enclose the IP address in square brackets, followed by a colon and the port number: exim4 -bs -oMa [10.9.8.7]:1234 The IP address is placed in the $sender_host_address vari‐ able, and the port, if present, in $sender_host_port. If both -oMa and -bh are present on the command line, the sender host IP address is taken from whichever one is last. -oMaa See -oMa above for general remarks about the -oM options. The -oMaa option sets the value of $sender_host_authenticated (the authenticator name). This option can be used with -bh and -bs to set up an authenticated SMTP session without actu‐ ally using the SMTP AUTH command. -oMai See -oMa above for general remarks about the -oM options. The -oMai option sets the value of $authenticated_id (the id that was authenticated). This overrides the default value (the caller's login id, except with -bh, where there is no de‐ fault) for messages from local sources. -oMas
See -oMa above for general remarks about the -oM options. The -oMas option sets the authenticated sender value in $authen‐ ticated_sender. It overrides the sender address that is cre‐ ated from the caller's login id for messages from local sources, except when -bh is used, when there is no default. For both -bh and -bs, an authenticated sender that is speci‐ fied on a MAIL command overrides this value. -oMi See -oMa above for general remarks about the -oM options. The -oMi option sets the IP interface address value. A port num‐ ber may be included, using the same syntax as for -oMa. The interface address is placed in $received_ip_address and the port number, if present, in $received_port. -oMm See -oMa above for general remarks about the -oM options. The -oMm option sets the message reference, e.g. message-id, and is logged during delivery. This is useful when some kind of audit trail is required to tie messages together. The format of the message reference is checked and will abort if the format is invalid. The option will only be accepted if exim is running in trusted mode, not as any regular user. The best example of a message reference is when Exim sends a bounce message. The message reference is the message-id of the original message for which Exim is sending the bounce. -oMr See -oMa above for general remarks about the -oM options. The -oMr option sets the received protocol value that is stored in $received_protocol. However, it does not apply (and is ig‐ nored) when -bh or -bs is used. For -bh, the protocol is forced to one of the standard SMTP protocol names. For -bs, the protocol is always "local-" followed by one of those same names. For -bS (batched SMTP) however, the protocol can be set by -oMr. Repeated use of this option is not supported. -oMs See -oMa above for general remarks about the -oM options. The -oMs option sets the sender host name in $sender_host_name. When this option is present, Exim does not attempt to look up a host name from an IP address; it uses the name it is given. -oMt See -oMa above for general remarks about the -oM options. The -oMt option sets the sender ident value in $sender_ident. The default setting for local callers is the login id of the calling process, except when -bh is used, when there is no default. -om In Sendmail, this option means "me too", indicating that the sender of a message should receive a copy of the message if the sender appears in an alias expansion. Exim always does this, so the option does nothing. -oo This option is ignored. In Sendmail it specifies "old style headers", whatever that means. -oP This option is useful only in conjunction with -bd or -q with a time value. The option specifies the file to which the process id of the daemon is written. When -oX is used with -bd, or when -q with a time is used without -bd, this is the only way of causing Exim to write a pid file, because in those cases, the normal pid file is not used. -or

SEE ALSO

exicyclog(8), exigrep(8), exim_checkaccess(8), exim_convert4r4(8), exim_db(8), exim_dbmbuild(8), exim_lock(8), eximon(8), exinext(8), ex‐ iqgrep(8), exiqsumm(8), exiwhat(8), update-exim4.conf(8), up‐ date-exim4defaults(8), /usr/share/doc/exim4-base/, /usr/share/doc/exim4-base/README.Debian.[gz|html]. The full Exim specification, the Exim book, and the Exim wiki.

AUTHOR

This manual page was provided with the upstream Exim source package. It was enhanced for the Debian GNU/Linux system. EXIM4(8)

Copied to clipboard
free 100$ digital ocean credit