{
    "mode": "man",
    "parameter": "mhmail",
    "section": "1mh",
    "url": "https://www.chedong.com/phpMan.php/man/mhmail/1mh/json",
    "generated": "2026-09-04T14:44:06Z",
    "synopsis": "mhmail [-help] [-version] [-to] addrs ...  [-attach file] [-body text] [-cc addrs ...]\n[-from addr] [-headerfield name:value] [-subject subject] [-resent] [switches for post\n... | -profile [switches for send ...]]  [-send | -nosend]\nmhmail with no arguments is equivalent to inc",
    "sections": {
        "NAME": {
            "content": "mhmail - send or read mail non-interactively with nmh\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mhmail [-help] [-version] [-to] addrs ...  [-attach file] [-body text] [-cc addrs ...]\n[-from addr] [-headerfield name:value] [-subject subject] [-resent] [switches for post\n... | -profile [switches for send ...]]  [-send | -nosend]\n\nmhmail with no arguments is equivalent to inc\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "mhmail is intended as a replacement, compatible with nmh, for the standard Berkeley mail pro‐\ngram  (mail or mailx).  nmh is intended for the use of programs such as cron, which expect to\nsend mail automatically.  It is also used by some nmh commands to mail  error  notifications.\nAlthough  mhmail  can be used interactively, it is recommended that comp and send be used in‐\nstead, to send messages.\n\nWhen invoked without arguments, mhmail simply invokes inc to incorporate  new  messages  from\nthe user's mail drop.\n\nWhen  one  or  more  addresses  are  specified, a message is read from the standard input and\nspooled to a temporary file.  mhmail then invokes by default, with the name of the  temporary\nfile  as  its argument, to by default, with the name of the temporary file as its argument to\ndeliver the message to the specified address.\n\nThe -subject switch can be used to specify the “Subject:” field of the  message.   “Subject:”\nfield of the message.\n\nThe -resent switch indicates that the message body is a fully formed message that will be re‐\nsent, as dist would do.  For example:\n\nmhmail u2@example.com -resent <`mhpath cur`\n\nBy default, mhmail will read the message to be sent from the standard input.  You can specify\nthe  text of the message at the command line with the -body text switch.  If the standard in‐\nput has zero length, mhmail will not send the message and return with status 1.  You can  use\nthe switch -body “” to force an empty message.\n\nNormally, addresses appearing as arguments are put in the “To:” field.  At least one such ad‐\ndress  is  required when sending a message, i.e., if any other switches are supplied.  If the",
            "subsections": [
                {
                    "name": "-cc",
                    "content": "than  -to, are placed in the “cc:” field.  The optional -to switch can appear in front of any\naddresses to signify their placement in the “To:” field.  The -to and  -cc  switches  may  be\ngiven multiple times.\n\nBy  using -from addr, you can specify the “From:” header of the draft.  If no -from switch is\nused when sending, mhmail will supply a “From:” header field using the sender's  local  mail‐\nbox,  see  localmbox in mh-format(5).  Naturally, post will fill in the “Sender:” header cor‐\nrectly.\n\nThe -headerfield name:value switch adds a header field with the specified name and  value  to\nthe message.  (The value is called the field body in RFC 2822, but that's too easily confused\nwith  the  message  body.)  There need not be a space after the colon that separates the name\nand value in the argument to this switch.  It is usually best  to  enclose  the  argument  in\nquotes  to protect it from the shell.  The -headerfield switch may be given multiple times to\nadd multiple header fields, for example,\n\nmhmail -from sender@example.com \\\n-headerfield 'MIME-Version:1.0' \\\n-headerfield 'Content-Type:text/plain; charset=utf-8' \\\n-headerfield 'Content-Transfer-Encoding:8bit' \\\nrecipient@example.com\n\nNote about this example:  the -attach switch causes MIME-Version and Content-Type headers  to\nbe added to the message.\n\nThe  -profile  switch instructs mhmail to use send instead of post to send the message.  This\nallows use of the user's context and aliases.\n\nThe -attach file switch attaches the specified file to the message.  Use of  -attach  enables"
                },
                {
                    "name": "-profile",
                    "content": "the argument in quotes to protect it from the shell.  The -attach switch may be given  multi‐\nple times to add multiple attachments.\n\nThe  -nosend  option shows the draft file that would be posted/sent on the command's standard\noutput but does not post or send it.  -send provides the default behavior of posting or send‐\ning the message.  It can be used to disable -nosend, for example, when using a shell alias.\n\nAll other switches are passed to post if -profile is not used, or send if -profile is used.\n"
                }
            ]
        },
        "FILES": {
            "content": "/usr/bin/mh/inc            Program to incorporate mail drop into folder\n/usr/lib/mh/post           Program to deliver a message\n/tmp/mhmail*               Temporary copy of message\n",
            "subsections": []
        },
        "PROFILE COMPONENTS": {
            "content": "mhmail does not consult the user's .mhprofile\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "dist(1), send(1), mh-format(5), send(1), post(8)\n",
            "subsections": []
        },
        "DEFAULTS": {
            "content": "`-from localmbox'\n`-profile' is enabled by default only with -attach\n`-send'\n",
            "subsections": []
        },
        "CONTEXT": {
            "content": "If inc is invoked, then inc's context changes occur.  With the -profile switch,  the  context\nof send is used.  mhmail does not read the context file itself.\n\nnmh-1.8                                      2012-07-01                                  MHMAIL(1mh)",
            "subsections": []
        }
    },
    "summary": "mhmail - send or read mail non-interactively with nmh",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "than -to, are placed in the “cc:” field. The optional -to switch can appear in front of any addresses to signify their placement in the “To:” field. The -to and -cc switches may be given multiple times. By using -from addr, you can specify the “From:” header of the draft. If no -from switch is used when sending, mhmail will supply a “From:” header field using the sender's local mail‐ box, see localmbox in mh-format(5). Naturally, post will fill in the “Sender:” header cor‐ rectly. The -headerfield name:value switch adds a header field with the specified name and value to the message. (The value is called the field body in RFC 2822, but that's too easily confused with the message body.) There need not be a space after the colon that separates the name and value in the argument to this switch. It is usually best to enclose the argument in quotes to protect it from the shell. The -headerfield switch may be given multiple times to add multiple header fields, for example, mhmail -from sender@example.com \\ -headerfield 'MIME-Version:1.0' \\ -headerfield 'Content-Type:text/plain; charset=utf-8' \\ -headerfield 'Content-Transfer-Encoding:8bit' \\ recipient@example.com Note about this example: the -attach switch causes MIME-Version and Content-Type headers to be added to the message. The -profile switch instructs mhmail to use send instead of post to send the message. This allows use of the user's context and aliases. The -attach file switch attaches the specified file to the message. Use of -attach enables"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "the argument in quotes to protect it from the shell. The -attach switch may be given multi‐ ple times to add multiple attachments. The -nosend option shows the draft file that would be posted/sent on the command's standard output but does not post or send it. -send provides the default behavior of posting or send‐ ing the message. It can be used to disable -nosend, for example, when using a shell alias. All other switches are passed to post if -profile is not used, or send if -profile is used."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "dist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/dist/1/json"
        },
        {
            "name": "send",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/send/1/json"
        },
        {
            "name": "mh-format",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/mh-format/5/json"
        },
        {
            "name": "send",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/send/1/json"
        },
        {
            "name": "post",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/post/8/json"
        }
    ]
}