1.\" Copyright (c) 1988, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)sendmail.8 8.5 (Berkeley) 06/01/94 7.\" 8.Dd 9.Dt SENDMAIL 8 10.Os BSD 4 11.Sh NAME 12.Nm sendmail 13.Nd send mail over the internet 14.Sh SYNOPSIS 15.Nm sendmail 16.Op Ar flags 17.Op Ar address ... 18.Nm newaliases 19.Nm mailq 20.Op Fl v 21.Sh DESCRIPTION 22.Nm Sendmail 23sends a message to one or more 24.Em recipients , 25routing the message over whatever networks 26are necessary. 27.Nm Sendmail 28does internetwork forwarding as necessary 29to deliver the message to the correct place. 30.Pp 31.Nm Sendmail 32is not intended as a user interface routine; 33other programs provide user-friendly 34front ends; 35.Nm sendmail 36is used only to deliver pre-formatted messages. 37.Pp 38With no flags, 39.Nm sendmail 40reads its standard input 41up to an end-of-file 42or a line consisting only of a single dot 43and sends a copy of the message found there 44to all of the addresses listed. 45It determines the network(s) to use 46based on the syntax and contents of the addresses. 47.Pp 48Local addresses are looked up in a file 49and aliased appropriately. 50Aliasing can be prevented by preceding the address 51with a backslash. 52Normally the sender is not included in any alias 53expansions, e.g., 54if `john' sends to `group', 55and `group' includes `john' in the expansion, 56then the letter will not be delivered to `john'. 57.Ss Parameters 58.Bl -tag -width Fl 59.It Fl B Ns Ar type 60Set the body type to 61.Ar type . 62Current legal values 63.Li 7BIT 64or 65.Li 8BITMIME . 66.It Fl ba 67Go into 68.Tn ARPANET 69mode. 70All input lines must end with a CR-LF, 71and all messages will be generated with a CR-LF at the end. 72Also, 73the ``From:'' and ``Sender:'' 74fields are examined for the name of the sender. 75.It Fl bd 76Run as a daemon. This requires Berkeley 77.Tn IPC . 78.Nm Sendmail 79will fork and run in background 80listening on socket 25 for incoming 81.Tn SMTP 82connections. 83This is normally run from 84.Pa /etc/rc . 85.It Fl bi 86Initialize the alias database. 87.It Fl bm 88Deliver mail in the usual way (default). 89.It Fl bp 90Print a listing of the queue. 91.It Fl bs 92Use the 93.Tn SMTP 94protocol as described in 95.Tn RFC821 96on standard input and output. 97This flag implies all the operations of the 98.Fl ba 99flag that are compatible with 100.Tn SMTP . 101.It Fl bt 102Run in address test mode. 103This mode reads addresses and shows the steps in parsing; 104it is used for debugging configuration tables. 105.It Fl bv 106Verify names only \- do not try to collect or deliver a message. 107Verify mode is normally used for validating 108users or mailing lists. 109.It Fl C Ns Ar file 110Use alternate configuration file. 111.Nm Sendmail 112refuses to run as root if an alternate configuration file is specified. 113.It Fl d Ns Ar X 114Set debugging value to 115.Ar X . 116.ne 1i 117.It Fl F Ns Ar fullname 118Set the full name of the sender. 119.It Fl f Ns Ar name 120Sets the name of the ``from'' person 121(i.e., the sender of the mail). 122.Fl f 123can only be used 124by ``trusted'' users 125(normally 126.Em root , 127.Em daemon , 128and 129.Em network ) 130or if the person you are trying to become 131is the same as the person you are. 132.It Fl h Ns Ar N 133Set the hop count to 134.Ar N . 135The hop count is incremented every time the mail is 136processed. 137When it reaches a limit, 138the mail is returned with an error message, 139the victim of an aliasing loop. 140If not specified, 141``Received:'' lines in the message are counted. 142.It Fl n 143Don't do aliasing. 144.It Fl o Ns Ar x Em value 145Set option 146.Ar x 147to the specified 148.Em value . 149Options are described below. 150.It Fl p Ns Ar protocol 151Set the name of the protocol used to receive the message. 152This can be a simple protocol name such as ``UUCP'' 153or a protocol and hostname, such as ``UUCP:ucbvax''. 154.It Fl q Ns Bq Ar time 155Processed saved messages in the queue at given intervals. 156If 157.Ar time 158is omitted, 159process the queue once. 160.Xr Time 161is given as a tagged number, 162with 163.Ql s 164being seconds, 165.Ql m 166being minutes, 167.Ql h 168being hours, 169.Ql d 170being days, 171and 172.Ql w 173being weeks. 174For example, 175.Ql \-q1h30m 176or 177.Ql \-q90m 178would both set the timeout to one hour thirty minutes. 179If 180.Ar time 181is specified, 182.Nm sendmail 183will run in background. 184This option can be used safely with 185.Fl bd . 186.It Fl r Ns Ar name 187An alternate and obsolete form of the 188.Fl f 189flag. 190.It Fl t 191Read message for recipients. 192To:, Cc:, and Bcc: lines will be scanned for recipient addresses. 193The Bcc: line will be deleted before transmission. 194Any addresses in the argument list will be suppressed, 195that is, 196they will 197.Em not 198receive copies even if listed in the message header. 199.It Fl v 200Go into verbose mode. 201Alias expansions will be announced, etc. 202.It Fl X Ar logfile 203Log all traffic in and out of mailers in the indicated log file. 204This should only be used as a last resort 205for debugging mailer bugs. 206It will log a lot of data very quickly. 207.El 208.Ss Options 209There are also a number of processing options that may be set. 210Normally these will only be used by a system administrator. 211Options may be set either on the command line 212using the 213.Fl o 214flag 215or in the configuration file. 216This is a partial list; 217for a complete list (and details), consult the 218.%T "Sendmail Installation and Operation Guide" . 219The options are: 220.Bl -tag -width Fl 221.It Li A Ns Ar file 222Use alternate alias file. 223.It Li b Ns Ar nblocks 224The minimum number of free blocks needed on the spool filesystem. 225.It Li c 226On mailers that are considered ``expensive'' to connect to, 227don't initiate immediate connection. 228This requires queueing. 229.It Li C Ar N 230Checkpoint the queue file after every 231.Ar N 232successful deliveries (default 10). 233This avoids excessive duplicate deliveries 234when sending to long mailing lists 235interrupted by system crashes. 236.ne 1i 237.It Li d Ns Ar x 238Set the delivery mode to 239.Ar x . 240Delivery modes are 241.Ql i 242for interactive (synchronous) delivery, 243.Ql b 244for background (asynchronous) delivery, 245and 246.Ql q 247for queue only \- i.e., 248actual delivery is done the next time the queue is run. 249.It Li D 250Try to automatically rebuild the alias database 251if necessary. 252.It Li e Ns Ar x 253Set error processing to mode 254.Ar x . 255Valid modes are 256.Ql m 257to mail back the error message, 258.Ql w 259to ``write'' back the error message 260(or mail it back if the sender is not logged in), 261.Ql p 262to print the errors on the terminal 263(default), 264.Ql q 265to throw away error messages 266(only exit status is returned), 267and 268.Ql e 269to do special processing for the BerkNet. 270If the text of the message is not mailed back 271by 272modes 273.Ql m 274or 275.Ql w 276and if the sender is local to this machine, 277a copy of the message is appended to the file 278.Pa dead.letter 279in the sender's home directory. 280.It Li f 281Save 282.Tn UNIX Ns \-style 283From lines at the front of messages. 284.It Li G 285Match local mail names against the GECOS portion of the password file. 286.It Li g Ar N 287The default group id to use when calling mailers. 288.It Li H Ns Ar file 289The 290.Tn SMTP 291help file. 292.It Li h Ar N 293The maximum number of times a message is allowed to ``hop'' 294before we decide it is in a loop. 295.It Li i 296Do not take dots on a line by themselves 297as a message terminator. 298.It Li j 299Send error messages in MIME format. 300.It Li K Ns Ar timeout 301Set connection cache timeout. 302.It Li k Ns Ar N 303Set connection cache size. 304.It Li L Ns Ar n 305The log level. 306.It Li l 307Pay attention to the Errors-To: header. 308.It Li m 309Send to ``me'' (the sender) also if I am in an alias expansion. 310.It Li n 311Validate the right hand side of aliases during a 312.Xr newaliases 1 313command. 314.It Li o 315If set, this message may have 316old style headers. 317If not set, 318this message is guaranteed to have new style headers 319(i.e., commas instead of spaces between addresses). 320If set, an adaptive algorithm is used that will correctly 321determine the header format in most cases. 322.It Li Q Ns Ar queuedir 323Select the directory in which to queue messages. 324.It Li S Ns Ar file 325Save statistics in the named file. 326.It Li s 327Always instantiate the queue file, 328even under circumstances where it is not strictly necessary. 329This provides safety against system crashes during delivery. 330.It Li T Ns Ar time 331Set the timeout on undelivered messages in the queue to the specified time. 332After delivery has failed 333(e.g., because of a host being down) 334for this amount of time, 335failed messages will be returned to the sender. 336The default is three days. 337.It Li t Ns Ar stz , Ar dtz 338Set the name of the time zone. 339.It Li U Ns Ar userdatabase 340If set, a user database is consulted to get forwarding information. 341You can consider this an adjunct to the aliasing mechanism, 342except that the database is intended to be distributed; 343aliases are local to a particular host. 344This may not be available if your sendmail does not have the 345.Dv USERDB 346option compiled in. 347.It Li u Ns Ar N 348Set the default user id for mailers. 349.It Li Y 350Fork each job during queue runs. 351May be convenient on memory-poor machines. 352.It Li 7 353Strip incoming messages to seven bits. 354.El 355.Pp 356In aliases, 357the first character of a name may be 358a vertical bar to cause interpretation of 359the rest of the name as a command 360to pipe the mail to. 361It may be necessary to quote the name 362to keep 363.Nm sendmail 364from suppressing the blanks from between arguments. 365For example, a common alias is: 366.Pp 367.Bd -literal -offset indent -compact 368msgs: "|/usr/bin/msgs -s" 369.Ed 370.Pp 371Aliases may also have the syntax 372.Dq :include: Ns Ar filename 373to ask 374.Xr sendmail 375to read the named file for a list of recipients. 376For example, an alias such as: 377.Pp 378.Bd -literal -offset indent -compact 379poets: ":include:/usr/local/lib/poets.list" 380.Ed 381.Pp 382would read 383.Pa /usr/local/lib/poets.list 384for the list of addresses making up the group. 385.Pp 386.Nm Sendmail 387returns an exit status 388describing what it did. 389The codes are defined in 390.Aq Pa sysexits.h : 391.Bl -tag -width EX_UNAVAILABLE -compact -offset indent 392.It Dv EX_OK 393Successful completion on all addresses. 394.It Dv EX_NOUSER 395User name not recognized. 396.It Dv EX_UNAVAILABLE 397Catchall meaning necessary resources 398were not available. 399.It Dv EX_SYNTAX 400Syntax error in address. 401.It Dv EX_SOFTWARE 402Internal software error, 403including bad arguments. 404.It Dv EX_OSERR 405Temporary operating system error, 406such as 407.Dq cannot fork . 408.It Dv EX_NOHOST 409Host name not recognized. 410.It Dv EX_TEMPFAIL 411Message could not be sent immediately, 412but was queued. 413.El 414.Pp 415If invoked as 416.Nm newaliases , 417.Nm sendmail 418will rebuild the alias database. 419If invoked as 420.Nm mailq , 421.Nm sendmail 422will print the contents of the mail queue. 423.Sh FILES 424Except for the file 425.Pa /etc/sendmail.cf 426itself, 427the following pathnames are all specified in 428.Pa /etc/sendmail.cf. 429Thus, 430these values are only approximations. 431.Pp 432.Bl -tag -width /usr/lib/sendmail.fc -compact 433.It Pa /etc/aliases 434raw data for alias names 435.It Pa /etc/aliases.db 436data base of alias names 437.It Pa /etc/sendmail.cf 438configuration file 439.It Pa /etc/sendmail.hf 440help file 441.It Pa /var/log/sendmail.st 442collected statistics 443.It Pa /var/spool/mqueue/* 444temp files 445.It Pa /var/run/sendmail.pid 446The process id of the daemon 447.El 448.Sh SEE ALSO 449.Xr binmail 1 , 450.Xr mail 1 , 451.Xr rmail 1 , 452.Xr syslog 3 , 453.Xr aliases 5 , 454.Xr mailaddr 7 , 455.Xr rc 8 ; 456.Pp 457DARPA 458Internet Request For Comments 459.%T RFC819 , 460.%T RFC821 , 461.%T RFC822 . 462.Rs 463.%T "Sendmail \- An Internetwork Mail Router" 464.%V SMM 465.%N \&No. 9 466.Re 467.Rs 468.%T "Sendmail Installation and Operation Guide" 469.%V SMM 470.%N \&No. 8 471.Re 472.Sh HISTORY 473The 474.Nm 475command appeared in 476.Bx 4.2 . 477