# phpman > man > send(1)

[SEND(1mh)](https://www.chedong.com/phpMan.php/man/SEND/1mh/markdown)                                                                                  [SEND(1mh)](https://www.chedong.com/phpMan.php/man/SEND/1mh/markdown)



## NAME
       send - send an nmh message

## SYNOPSIS
       **send** [**-help**] [**-version**] [**-alias** _aliasfile_] [**-draft**] [**-draftfolder** _+folder_] [**-draftmessage**
            _msg_] [**-nodraftfolder**] [**-filter** _filterfile_] [**-nofilter**] [**-format** | **-noformat**] [**-forward** |
            **-noforward**] [**-mime** | **-nomime**] [**-msgid** | **-nomsgid**] [**-messageid** _localname_ | _random_] [**-push**
            | **-nopush**] [**-split** _seconds_] [**-verbose** | **-noverbose**] [**-watch** | **-nowatch**] [**-mts** _smtp_ |
            _sendmail/smtp_ | _sendmail/pipe_] [**-sendmail** _program_] [**-server** _servername_] [**-port** _port-_
            _name/number_] [**-sasl**] [**-nosasl**] [**-saslmech** _mechanism_] [**-authservice** _service_] [**-snoop**]
            [**-user** _username_] [**-tls**] [**-initialtls**] [**-notls**] [**-certverify**] [**-nocertverify**] [**-width**
            _columns_] [**file** ...]

## DESCRIPTION
       **send** will cause each of the specified files to be delivered to each of  the  destinations  in
       the “To:”, “cc:”, “Bcc:”, “Dcc:”, and “Fcc:” fields of the message.  If **send** is re-distribut‐
       ing a message, as invoked from **dist**, then the corresponding “Resent-xxx” fields are  examined
       instead.

       By  default,  **send**  uses the program **post** to do the actual delivery of the messages, although
       this can be changed by defining the _postproc_ profile component.  Most of the features attrib‐
       uted to **send** are actually performed by **post**.

       Before  **send**  gives  the message to **post** for delivery, the message is processed by **mhbuild** to
       perform any necessary MIME encoding of the outgoing message.  This  can  be  changed  by  the
       _buildmimeproc_ profile component.  **mhbuild** is invoked with the **-auto** switch, so **mhbuild** direc‐
       tives are not processed by default.  See [_mhbuild_(1)](https://www.chedong.com/phpMan.php/man/mhbuild/1/markdown) for more information.

       **mhbuild** will scan the message draft for a header named _Attach_.  The draft is converted  to  a
       MIME  message if one or more matches are found.  This conversion occurs before all other pro‐
       cessing.  The [_whatnow_(1)](https://www.chedong.com/phpMan.php/man/whatnow/1/markdown) man page describes the user interface for managing MIME  attachments
       via this mechanism.

       The  first  part  of  the  MIME message is the draft body if that body contains any non-blank
       characters.  The body of each _Attach_ header field is interpreted as a  file  name,  and  each
       file named is included as a separate part in the MIME message.

       Determination  of  the  content MIME type inserted into the Content-Type header for each part
       depends on how the **nmh** installation was configured.  If a program, such as **file** with a **--mime**
       or  **-i** option, was found that can specify the type of a file as a MIME type string, then that
       will be used.  To determine if your **nmh** was so configured, run **mhparam** **mimetypeproc**  and  see
       if a non-empty string is displayed.

       If your **nmh** was not configured with a program to specify a file type as a MIME string, then a
       different method is used to determine the content-type string.  For file names with dot  suf‐
       fixes,  the  profile is scanned for a _mhshow-suffix-_ entry for that suffix.  The content-type
       for the part is taken from that profile entry if a match is found.  If a match is  not  found
       in  the  user profile, the mhn.defaults profile is scanned next.  If no match is found or the
       file does not have a dot suffix, the content-type is text/plain if  the  file  contains  only
       ASCII  characters  or application/octet-stream if it contains characters outside of the ASCII
       range.  See [_mhshow_(1)](https://www.chedong.com/phpMan.php/man/mhshow/1/markdown) for more details and example syntax.

       Each attached MIME part contains a “Content-Description” header that includes  the  filename,
       and  adds a “Content-Disposition” header.  Here is an example of MIME part headers for an at‐
       tachment:

       Content-Type: text/plain; name="VERSION"; charset="us-ascii"
       Content-Description: VERSION
       Content-Disposition: attachment; filename="VERSION"

       See [_mhbuild_(1)](https://www.chedong.com/phpMan.php/man/mhbuild/1/markdown) for explanation of how the Content-Disposition value is selected.

       If **-push** is specified, **send** will detach itself from the user's terminal and perform  its  ac‐
       tions  in  the background.  If **push**'d and the draft can't be sent, then an error message will
       be sent (using the mailproc) back to the user.  If **-forward** is given,  then  a  copy  of  the
       draft  will be attached to this failure notice.  Using **-push** differs from putting **send** in the
       background because the output is trapped and analyzed by **nmh**.

       If **-verbose** is specified, **send** will indicate the interactions occurring  with  the  transport
       system,  prior  to actual delivery.  If **-watch** is specified **send** will monitor the delivery of
       local and network mail.  Hence, by specifying both switches, a large  detail  of  information
       can be gathered about each step of the message's entry into the transport system.

       The **-draftfolder** _+folder_ and **-draftmessage** _msg_ switches invoke the **nmh** draft folder facility.
       This is an advanced (and highly useful) feature.  Consult the [_mh-draft_(5)](https://www.chedong.com/phpMan.php/man/mh-draft/5/markdown) man page  for  more
       information.

       If  **-split** is specified, **send** will split the draft into one or more partial messages prior to
       sending.  This makes use of the MIME features in **nmh**.  Note however that if **send**  is  invoked
       under  **dist**,  then  this  switch is ignored -- it makes no sense to redistribute a message in
       this fashion.  Sometimes you want **send** to pause after posting a  partial  message.   This  is
       usually  the  case when you are running **sendmail** and expect to generate a lot of partial mes‐
       sages.  The argument to **-split** tells it how long to pause between postings.

       **send** with no _file_ argument will query whether the draft is the intended file, whereas  **-draft**
       will  suppress this question.  Once the transport system has successfully accepted custody of
       the message, the file will be renamed with a site-dependent prefix (usually a  comma),  which
       allows  it  to be retrieved until the next draft message is sent.  If there are errors in the
       formatting of the message, **send** will abort with a (hopefully) helpful error message.

       If a “Bcc:” field is encountered, its addresses will be used for  delivery,  and  the  “Bcc:”
       field will be removed from the message sent to sighted recipients.  The blind recipients will
       receive an entirely new message with a minimal set of headers. The body of this  new  message
       will  contain a copy of the message sent to the sighted recipients, either marked up with the
       indicator text "Blind-Carbon-Copy" or encapsulated as a MIME digest.

       If a “Dcc:” field is encountered and the **sendmail/pipe** mail transport method is not  in  use,
       its  addresses  will be used for delivery, and the “Dcc:” field will be removed from the mes‐
       sage.  The blind recipients will receive exactly the same message as the sighted  recipients.
       *WARNING* Recipients listed in the “Dcc:” field receive no explicit indication that they have
       received a “blind copy”.  This can cause blind recipients to inadvertently reply  to  all  of
       the  sighted  recipients  of the original message, revealing that they received a blind copy.
       On the other hand, since a normal reply to a message sent via a “Bcc:” field will generate  a
       reply  only  to  the sender of the original message, it takes extra effort in most mailers to
       reply to the included message, and so would usually only be done deliberately, rather than by
       accident.

       If  the  **sendmail/pipe** mail transport method is used, then messages containing a “Dcc:” field
       are rejected.


       If **-filter** _filterfile_ is specified, then this copy is filtered (re-formatted) by **mhl** prior to
       being  sent to the blind recipients.  Alternately, if you specify the **-mime** switch, then **send**
       will use the MIME rules for encapsulation.

       Prior to sending the message, the “Date: now” field will be appended to the  headers  in  the
       message.   If  **-msgid** is specified, then a “Message-ID:” field will also be added to the mes‐
       sage.

       The **-messageid** switch selects the style used for the part appearing  after  the  @  in  “Mes‐
       sage-ID:”, “Resent-Message-ID:”, and “Content-ID:” header fields.  The two acceptable options
       are **localname** (which is the default), and **random**.  With  **localname**,  the  local  hostname  is
       used.   With  **random**,  a random sequence of characters is used instead.  Note that the **-msgid**
       switch must be enabled for this switch to have any effect.

       If **send** is re-distributing a message (when invoked by **dist**), then “Resent-” will be prepended
       to each of these fields: “From:”, “Date:”, and “Message-ID:”.

       A  “From:”  field is required for all outgoing messages.  Multiple addresses are permitted in
       the “From:” field, but a “Sender:” field is required in this  case.   Otherwise  a  “Sender:”
       field is optional.

       If  a message with multiple “From:” addresses does _not_ include a “Sender:” field but does in‐
       clude an “Envelope-From:” field, the “Envelope-From:” field  will  be  used  to  construct  a
       “Sender:” field.

       When  using  SMTP for mail submission, the envelope-from used for the SMTP transaction is de‐
       rived from the  “Envelope-From:”  field.   If  no  “Envelope-From:”  field  is  present,  the
       “Sender:” field is used.  If neither the “Envelope-From:” nor the “Sender:” field is present,
       the “From:” field is used.  When “Envelope-From:” appears in a message  it  will  be  removed
       from the final outgoing message.

       By  using  the  **-format** switch, each of the entries in the “To:” and “cc:” fields will be re‐
       placed with “standard” format entries.  This standard format is designed to be usable by  all
       of  the  message handlers on the various systems around the Internet.  If **-noformat** is given,
       then headers are output exactly as they appear in the message draft.

       If an “Fcc: folder” is encountered, the message will be copied to the  specified  folder  for
       the  sender  in  the  format in which it will appear to any non-Bcc receivers of the message.
       That is, it will have the appended fields and field reformatting.  The “Fcc:” fields will  be
       removed from all outgoing copies of the message.

       Beware  that  if an “Fcc:” with one or more folders is present but none of the folders exist,
       and the default _fileproc_ and _postproc_ are in use, then **refile** will prompt the user to  create
       the  folder(s) if **-push** is not specified.  If all responses are negative, or creation of each
       folder fails, or **-push** is specified, the message will not be copied to any folder and will be
       removed by **post.**  With the default **refile** switches, the message draft will be renamed accord‐
       ing to the specification of its **-nolink** switch.

       By using the **-width** _columns_ switch, the user can direct **send** as to how long  it  should  make
       header lines containing addresses.

       The mail transport system default is provided in _/etc/nmh/mts.conf_ but can be overridden here
       with the **-mts** switch.

       If nmh is using as its mail transport system **sendmail/pipe**, the **-sendmail** switch can be  used
       to override the default **sendmail** program.

       If  nmh is using the SMTP MTA, the **-server** and the **-port** switches can be used to override the
       default mail server (defined by the _/etc/nmh/mts.conf_ servers entry).  The **-snoop** switch  can
       be  used to view the SMTP transaction.  (Beware that the SMTP transaction may contain authen‐
       tication information either in plaintext or  easily  decoded  base64.)   If  **-sasl**  **-saslmech**
       **xoauth2** is used, the HTTP transaction is also shown.

       If  **nmh**  has  been compiled with SASL support, the **-sasl** and **-nosasl** switches will enable and
       disable the use of SASL authentication with the SMTP MTA.  Depending on  the  SASL  mechanism
       used, this may require an additional password prompt from the user (but the _netrc_ file can be
       used to store this password, as described in the  [mh-profile(5)](https://www.chedong.com/phpMan.php/man/mh-profile/5/markdown)  man  page).   The  **-saslmech**
       switch can be used to select a particular SASL mechanism, and the **-user** switch can be used to
       select a authorization userid to provide to SASL other than  the  default.   The  credentials
       profile entry in the [mh-profile(5)](https://www.chedong.com/phpMan.php/man/mh-profile/5/markdown) man page describes the ways to supply a username and pass‐
       word.

       If SASL authentication is successful, **nmh** will attempt to negotiate a security layer for ses‐
       sion  encryption.  Encrypted data is labelled with `(encrypted)' and `(decrypted)' when view‐
       ing the SMTP transaction with the **-snoop** switch; see the **post** man page description of  **-snoop**
       for its other features.

       If  **nmh**  has  been compiled with OAuth support, the **-sasl** and **-saslmech** **xoauth2** switches will
       enable OAuth authentication.  The **-user** switch must be used, and  the  _username_  must  be  an
       email  address  the  user  has for the service, which must be specified with the **-authservice**
       _service_ switch.  Before using OAuth authentication, the user must authorize  nmh  by  running
       **mhlogin**  and  grant  authorization to that account.  See the [_mhlogin_(1)](https://www.chedong.com/phpMan.php/man/mhlogin/1/markdown) man page for more de‐
       tails.

       If **nmh** has been compiled with TLS support, the **-tls** and **-initialtls** switches will require the
       negotiation  of  TLS  when connecting to the SMTP MTA.  The **-tls** switch will negotiate TLS as
       part of the normal SMTP protocol using the STARTTLS command.  The **-initialtls** will  negotiate
       TLS  immediately  after  the connection has taken place, before any SMTP commands are sent or
       received.  Encrypted data is labelled with `(tls-encrypted)' and `(tls-decrypted)' when view‐
       ing  the SMTP transaction with the **-snoop** switch; see the **post** man page description of **-snoop**
       for its other features.  The **-notls** switch will disable all attempts to negotiate TLS.

       If port 465 is specified and none of the TLS switches were enabled, **-initialtls** will  be  im‐
       plied if TLS support was compiled in.  Though port 465 for SMTPS (SMTP over SSL) was deregis‐
       tered by IANA in 1998, it is still used for that service.

       When using TLS the default is to verify the remote certificate and  SubjectName  against  the
       local trusted certificate store.  This can be controlled by the **-certverify** and **-nocertverify**
       switches.  See your OpenSSL documentation for more information on certificate verification.

       The files specified by the profile entry “Aliasfile:” and any additional alias files given by
       the **-alias** _aliasfile_ switch will be read (more than one file, each preceded by **-alias**, can be
       named).  See [_mh-alias_(5)](https://www.chedong.com/phpMan.php/man/mh-alias/5/markdown) for more information.

### Selection based on sender address: sendfrom
       One or more _sendfrom_ profile components can be used to select a  mail  server  address,  mail
       server  port, or any other switch that can be supplied to **post**.  It works by first looking at
       the sender address and domain name in the message draft, as described below.  It  then  looks
       for  a corresponding profile entry, which contains the **post** switches.  To enable, add profile
       entries of the form:

            sendfrom-_address/domain_ _name_: _post_ _switches_

       The email address is extracted from the Envelope-From:  header, if  not  blank,  the  Sender:
       header,  or  the From: header line in the message draft.  Multiple profile entries, with dif‐
       ferent email addresses or domain names, are supported.  This  allows  different  switches  to
       **post**,  such  as  -user, to be associated with different email addresses.  If a domain name is
       used, it matches all users in that domain.

       Here is an example profile entry using OAuth for an account hosted by gmail:

            <sendfrom-gmail_address@example.com>: -sasl -saslmech xoauth2
                 -authservice gmail -tls -server smtp.gmail.com
                 -user <gmail_login@example.com>

       (Indentation indicates a continued line, as supported in MH profiles.)  The username need not
       be  the  same  as the sender address, which was extracted from the appropriate header line as
       noted above.

       Here are example profile entries that use an nmh credentials file:

            credentials: file:nmhcreds
            <sendfrom-sendgrid_address@example.com>: -sasl -tls
                 -server smtp.sendgrid.net
            sendfrom-outbound.att.net: -sasl -initialtls
                 -server outbound.att.net -port 465
            sendfrom-fastmail.com: -initialtls -sasl -saslmech LOGIN
                 -server smtps-proxy.messagingengine.com -port 80

       where nmhcreds is in the user's nmh directory (from the Path profile component) and contains:

            machine smtp.sendgrid.net
                 login <sendgrid_login@example.com>
                 password ********
            machine outbound.att.net
                 login <att_login@example.com>
                 password ********
            machine smtps-proxy.messagingengine.com
                 login <fastmail_login@example.com>
                 password ********

       For more information on authentication to mail servers, see the [_mhlogin_(1)](https://www.chedong.com/phpMan.php/man/mhlogin/1/markdown) man page for OAuth
       services, and [_mh-profile_(5)](https://www.chedong.com/phpMan.php/man/mh-profile/5/markdown) man page for login credentials.

## FILES
       $HOME/.mh_profile          The user profile

## PROFILE COMPONENTS
       Path:                To determine the user's nmh directory
       Draft-Folder:        To find the default draft-folder
       Aliasfile:           For a default alias file
       Signature:           To determine the user's mail signature
       mailproc:            Program to post failure notices
       postproc:            Program to post the message
       sendfrom-address:    Switches to post for sender address
       sendfrom-domain:     Switches to post for sender domain name

## SEE ALSO
       [_comp_(1)](https://www.chedong.com/phpMan.php/man/comp/1/markdown),  [_dist_(1)](https://www.chedong.com/phpMan.php/man/dist/1/markdown),  [_file_(1)](https://www.chedong.com/phpMan.php/man/file/1/markdown), [_forw_(1)](https://www.chedong.com/phpMan.php/man/forw/1/markdown), [_mhbuild_(1)](https://www.chedong.com/phpMan.php/man/mhbuild/1/markdown), [_mhparam_(1)](https://www.chedong.com/phpMan.php/man/mhparam/1/markdown), [_mhlogin_(1)](https://www.chedong.com/phpMan.php/man/mhlogin/1/markdown), [_refile_(1)](https://www.chedong.com/phpMan.php/man/refile/1/markdown), [_repl_(1)](https://www.chedong.com/phpMan.php/man/repl/1/markdown),
       [_whatnow_(1)](https://www.chedong.com/phpMan.php/man/whatnow/1/markdown), [_mh-alias_(5)](https://www.chedong.com/phpMan.php/man/mh-alias/5/markdown), [_mh-profile_(5)](https://www.chedong.com/phpMan.php/man/mh-profile/5/markdown), [_mh-tailor_(5)](https://www.chedong.com/phpMan.php/man/mh-tailor/5/markdown), [_post_(8)](https://www.chedong.com/phpMan.php/man/post/8/markdown)

## DEFAULTS
       `**file**' defaults to <mh-dir>/draft
       `**-alias**' defaults to /etc/nmh/MailAliases
       `**-nodraftfolder**'
       `**-nofilter**'
       `**-format**'
       `**-forward**'
       `**-nomime**'
       `**-nomsgid**'
       `**-messageid** **localname**'
       `**-nopush**'
       `**-noverbose**'
       `**-nowatch**'
       `**-width** **72**'
       `**-certverify**'

## CONTEXT
       None

## BUGS
       Under some configurations, it is not possible  to  monitor  the  mail  delivery  transaction;
### -watch

       Using **-split** _0_ doesn't work correctly.



nmh-1.7.1                                    2017-05-11                                    [SEND(1mh)](https://www.chedong.com/phpMan.php/man/SEND/1mh/markdown)
