SEND(1) [mh.6] (MH.6.8) SEND(1)
NAME
send - send a message
SYNOPSIS
send [-alias aliasfile] [-draft] [-draftfolder +folder]
[-draftmessage msg] [-nodraftfolder]
[-filter filterfile] [-nofilter] [-format] [-noformat]
[-forward] [-noforward] [-msgid] [-nomsgid] [-push]
[-nopush] [-verbose] [-noverbose] [-watch] [-nowatch]
[-width columns] [file ...] [-help]
DESCRIPTION
Send will cause each of the specified files to be delivered
(via post (8)) to each of the destinations in the To:, cc:,
Bcc:, and Fcc: fields of the message. If send is
re-distributing a message, as invoked from dist, then the
corresponding Resent-xxx fields are examined instead.
If `-push' is specified, send will detach itself from the
user's terminal and perform its actions in the background.
If push 'd and the draft can't be sent, then the `-forward'
switch says that draft should be forwarded with the failure
notice sent to the user. This differs from putting send in
the background because the output is trapped and analyzed by
MH.
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 MH draft folder facility. This is an advanced
(and highly useful) feature. Consult the Advanced Features
section of the MH manual for more information.
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 leading 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
Page 1 (printed 9/30/94)
SEND(1) [mh.6] (MH.6.8) SEND(1)
headers. Included in the body of the message will be a copy
of the message sent to the sighted recipients. If
`-filter filterfile' is specified, then this copy is
filtered (re-formatted) prior to being sent to the blind
recipients.
Prior to sending the message, the fields From: user@local,
and Date: now will be appended to the headers in the
message. If the envariable $SIGNATURE is set, then its
value is used as your personal name when constructing the
From: line of the message. If this envariable is not set,
then send will consult the profile entry Signature for this
information. On hosts where MH was configured with the UCI
option, if $SIGNATURE is not set and the Signature profile
entry is not present, then the file $HOME/.signature is
consulted. If `-msgid' is specified, then a Message-ID:
field will also be added to the message.
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:. If the message
already contains a From: field, then a Sender: user@local
field will be added as well. (An already existing Sender:
field is an error!)
By using the `-format' switch, each of the entries in the
To: and cc: fields will be replaced 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.
By using the `-width columns' switch, the user can direct
send as to how long it should make header lines containing
addresses.
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 preceeded by
`-alias', can be named). See mh-alias (5) for more
information.
FILES
$HOME/.mh_profile The user profile
Page 2 (printed 9/30/94)
SEND(1) [mh.6] (MH.6.8) SEND(1)
PROFILE COMPONENTS
Path: To determine the user's MH 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
SEE ALSO
comp(1), dist(1), forw(1), repl(1), mh-alias(5), post(8)
DEFAULTS
`file' defaults to <mh-dir>/draft
`-alias /usr/local/lib/mh/MailAliases'
`-nodraftfolder'
`-nofilter'
`-format'
`-forward'
`-nomsgid'
`-nopush'
`-noverbose'
`-nowatch'
`-width 72'
CONTEXT
None
BUGS
Under some configurations, it is not possible to mointor the
mail delivery transaction; `-watch' is a no-op on those
systems.
Page 3 (printed 9/30/94)
SEND(2) SEND(2)
NAME
send, sendto, sendmsg - send a message from a socket
C SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>
int send(int s, const void *msg, int len, int flags);
int sendto(int s, const void *msg, int len, int flags,
struct sockaddr *to, int tolen);
int sendmsg(int s, const struct msghdr *msg, int flags);
DESCRIPTION
Send, sendto, and sendmsg are used to transmit a message to another
socket. Send may be used only when the socket is in a connected state,
while sendto and sendmsg may be used when the socket is unconnected.
The address of the target is given by to with tolen specifying its size.
The length of the message is given by len. If the message is too long to
pass atomically through the underlying protocol, then the error EMSGSIZE
is returned, and the message is not transmitted.
Usually no indication of failure to deliver is implicit in a send.
Return values of -1 indicate some locally detected errors. Connected
datagram sockets may receive error indications from a previous send.
If no messages space is available at the socket to hold the message to be
transmitted, then send normally blocks, unless the socket has been placed
in non-blocking I/O mode. The select(2) call may be used to determine
when it is possible to send more data.
The flags parameter may include one or more of the following:
#define MSG_OOB 0x1 /* process out-of-band data */
#define MSG_DONTROUTE 0x4 /* bypass routing,
use direct interface */
The flag MSG_OOB is used to send "out-of-band" data on sockets that
support this notion (e.g., SOCK_STREAM); the underlying protocol must
also support "out-of-band" data. MSG_DONTROUTE is usually used only by
diagnostic or routing programs.
See recv(2) for a description of the msghdr structure.
RETURN VALUE
The call returns the number of characters sent, or -1 if an error
occurred.
Page 1
SEND(2) SEND(2)
ERRORS
[EBADF] An invalid descriptor was specified.
[ENOTSOCK] The argument s is not a socket.
[EFAULT] An invalid user space address was specified for a
parameter.
[EMSGSIZE] The socket requires that message be sent atomically,
and the size of the message to be sent made this
impossible.
[EWOULDBLOCK] The socket is marked non-blocking and the requested
operation would block.
[ENOBUFS] The system was unable to allocate an internal buffer.
The operation may succeed when buffers become
available.
[ENOBUFS] The output queue for a network interface was full.
This generally indicates that the interface has
stopped sending, but may be caused by transient
congestion.
[ECONNREFUSED] The remote port was invalid when using the send call
on a connected datagram socket.
[EISCONN] A sendto or sendmsg call was used on a connected
socket.
[EACCES] The requested operation specified a broadcast address
as the destination but the SO_BROADCAST socket option
was not enabled (see setsockopt(2)).
SEE ALSO
fcntl(2), recv(2), select(2), getsockopt(2), socket(2), write(2)
NOTE
ABI-compliant versions of the above call can be obtained from
libsocket.so which provides an equivalent (but slower) implementation
atop STREAMS.
Page 2
send(3N) send(3N)
NAME
send, sendto, sendmsg - send a message from a socket
SYNOPSIS
#include <sys/types.h>
int send(int s, char *msg, int len, int flags);
int sendto(int s, char *msg, int len, int flags, caddr_t to,
int tolen);
int sendmsg(int s, msghdr *msg, int flags);
DESCRIPTION
s is a socket created with socket. send, sendto, and sendmsg are used to
transmit a message to another socket. send may be used only when the
socket is in a connected state, while sendto and sendmsg may be used at
any time.
The address of the target is given by to with tolen specifying its size.
The length of the message is given by len. If the message is too long to
pass atomically through the underlying protocol, then the error EMSGSIZE
is returned, and the message is not transmitted.
No indication of failure to deliver is implicit in a send. Return values
of -1 indicate some locally detected errors.
If no buffer space is available at the socket to hold the message to be
transmitted, then send normally blocks, unless the socket has been placed
in non-blocking I/O mode [see fcntl(2)]. The select call may be used to
determine when it is possible to send more data.
The flags parameter is formed by ORing one or more of the following:
MSG_OOB Send out-of-band data on sockets that support this notion. The
underlying protocol must also support out-of-band data.
Currently, only SOCK_STREAM sockets created in the AF_INET
address family support out-of-band data.
MSG_DONTROUTE
The SO_DONTROUTE option is turned on for the duration of the
operation. It is used only by diagnostic or routing programs.
See recv(3N) for a description of the msghdr structure.
RETURN VALUE
These calls return the number of bytes sent, or -1 if an error occurred.
ERRORS
The calls fail if:
Page 1
send(3N) send(3N)
EBADF s is an invalid descriptor.
ENOTSOCK s is a descriptor for a file, not a socket.
EINVAL tolen is not the size of a valid address for the
specified address family.
EINTR The operation was interrupted by delivery of a signal
before any data could be buffered to be sent.
EMSGSIZE The socket requires that message be sent atomically,
and the message was too long.
EWOULDBLOCK The socket is marked non-blocking and the requested
operation would block.
ENOMEM There was insufficient user memory available for the
operation to complete.
ENOSR There were insufficient STREAMS resources available
for the operation to complete.
SEE ALSO
fcntl(2), write(2), connect(3N), getsockopt(3N), recv(3N), socket(3N)
NOTES
The type of address structure passed to accept depends on the address
family. UNIX domain sockets (address family AF_UNIX) require a
socketaddr_un structure as defined in sys/un.h; Internet domain sockets
(address family AF_INET) require a sockaddr_in structure as defined in
netinet/in.h. Other address families may require other structures. Use
the structure appropriate to the address family; cast the structure
address to a generic caddr_t in the call to send and pass the size of the
structure in the tolen argument.
Page 2