dacsemail(1) Simple outgoing email agent


dacsemail [-bcc addr] [{-bf | --bodyfilepath] [{-bs | --bodystringstring] [-cc addr]
[-ct value] [{-f | --fromfrom] [-h | --help] [-header name value]
[{-mailer | -mtapath] [{-mailer-flags | -mta-flagsstring] [-p | --prompt] [-save path] [{-s | --subjectsubject] [-sender sender] [{-t | --toaddr] [-transform] [-v | --verbose] [-var name value]


This program is part of the DACS suite.

The dacsemail utility is a simple agent for sending email messages. It is a stand-alone program that neither accepts the usual DACS command line options (m[blue]dacsoptionsm[][1]) nor accesses any DACS configuration files.

dacsemail constructs an m[blue]RFC 822m[][2] format message but does not transmit it. It requires an external mailer, such as m[blue]sendmail(8)m[][3], to transfer the message. The mailer command and its arguments can be specified on the dacsemail command line (see -mailer) or at build time (see m[blue]dacs.install(7)m[][4]).


If the source for the message body is not specified on the command line, it will be read from the standard input. At least one recipient must be specified using -t, -cc, or -bcc.

-bcc addr

Send the message to the undisclosed recipient address addr. It is the responsibility of the mailer to delete these recipient addresses before transmitting the message. This flag may be repeated.

-bf path
--bodyfile path

Read the message body from path. If path is -, the standard input is read.

-bs string
--bodystring string

Use string as the message body.

-cc addr

Send the message to recipient addr as a carbon copy. This flag may be repeated.

-ct value

Add a Content-type header of MIME type value to the message. If value is multipart/alternative, an appropriate boundary variable will be created, unless one has already been specified on the command line with the -var flag. It is assumed that the message body has already been correctly formatted for this MIME type, or will be after it has been transformed (see -transform).

-f from
--from from

Use from as the value of the message's From header.


Print usage information and then exit.

-header name value

Add a message header named name with value value. This flag should only be used for headers that do not have specific flags (-t, -ct, -f, and so on).

-mailer path
-mta path

Use the message transfer agent command path (a full pathname) instead of the configured program. This program must read the message from its standard input and extract the list of recipients from the message's To, Cc, and Bcc headers. (If such a mailer is unavailable, it will be necessary to write a small program to wrap a mailer and provide the required interface to dacsemail.) The default is to run m[blue]sendmail(8)m[][3] with its -t flag.

-mailer-flags string
-mta-flags string

Regardless of the mailer, use string for its command line flags.


Just before the message is to be sent, display it (to stderr) and wait for the user to respond to a prompt. At the prompt, the user may abort the message or allow it to be sent.

-save path

Just before sending (or prompting), write a copy of the outgoing message to path, replacing any previous contents of the file.

-s subject
--subject subject

Set the message's Subject header to subject.

-sender sender

Set the message's Sender header to sender.

-t addr
--to addr

Add addr as a "To" recipient. This flag may be repeated.


The message body, regardless of how it is specified, is filtered through the DACS transformation function. Please refer to m[blue]dacs_transform(8)m[][5] for details. No access control rules may be associated with any transformation; i.e., they are all unconditional. A similar effect can be obtained by piping the output of m[blue]dacstransform(1)m[][6] into dacsemail.


Enable verbose output for debugging.

-var name value

Create m[blue]a variablem[][7] named name set to value for the transform function. The variable's value can be referenced within the message body in the DACS namespace as ${DACS::name}. The variable must not already be defined.


Suppose myfile contains the following text:

<!--DACS expand="*" -->
This is a multi-part message in MIME format.
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Hello, ${DACS::user}!
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
<font color="red">Hello, ${DACS::user}!</font>
<!--DACS end="*" -->

The following command might be used to send a message with a multipart/alternative structured body:

% dacsemail -ct multipart/alternative -f [email protected] \
      -t [email protected] -s "Hello" -transform -var user Auggie -bf myfile

The resulting message will look something like the following:

To: [email protected]
From: [email protected]
Subject: Hello
Content-type: multipart/alternative; boundary="_----------=_03885942562898683484"
Date: Wed, 07 Apr 2010 16:48:41 -0700 (PDT)
Content-transfer-encoding: 7bit
X-mailer: DACS 1.4.24a
This is a multi-part message in MIME format.
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Hello, Auggie!
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
<font color="red">Hello, Auggie!</font>




The program exits 0 if everything was fine, 1 if an error occurred. Error messages are printed to stderr. Errors and routine messages from the mailer are recorded wherever they are normally logged, outside of DACS


This program's primary purpose is for testing DACS functionality that is needed for internal purposes. No significant improvements are envisioned. You could throw a rock and hit a better email agent.


Distributed Systems Software (m[blue]www.dss.cam[][9])


Copyright2003-2013 Distributed Systems Software. See the m[blue]LICENSEm[][10] file that accompanies the distribution for licensing information.