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.6 (Berkeley) 05/27/95 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 qI Ns Ar substr 187Limit processed jobs to those containing 188.Ar substr 189as a substring of the queue id. 190.It Fl qR Ns Ar substr 191Limit processed jobs to those containing 192.Ar substr 193as a substring of one of the recipients. 194.It Fl qS Ns Ar substr 195Limit processed jobs to those containing 196.Ar substr 197as a substring of the sender. 198.It Fl r Ns Ar name 199An alternate and obsolete form of the 200.Fl f 201flag. 202.It Fl t 203Read message for recipients. 204To:, Cc:, and Bcc: lines will be scanned for recipient addresses. 205The Bcc: line will be deleted before transmission. 206Any addresses in the argument list will be suppressed, 207that is, 208they will 209.Em not 210receive copies even if listed in the message header. 211.It Fl v 212Go into verbose mode. 213Alias expansions will be announced, etc. 214.It Fl X Ar logfile 215Log all traffic in and out of mailers in the indicated log file. 216This should only be used as a last resort 217for debugging mailer bugs. 218It will log a lot of data very quickly. 219.El 220.Ss Options 221There are also a number of processing options that may be set. 222Normally these will only be used by a system administrator. 223Options may be set either on the command line 224using the 225.Fl o 226flag 227or in the configuration file. 228This is a partial list; 229for a complete list (and details), consult the 230.%T "Sendmail Installation and Operation Guide" . 231The options are: 232.Bl -tag -width Fl 233.It Li A Ns Ar file 234Use alternate alias file. 235.It Li b Ns Ar nblocks 236The minimum number of free blocks needed on the spool filesystem. 237.It Li c 238On mailers that are considered ``expensive'' to connect to, 239don't initiate immediate connection. 240This requires queueing. 241.It Li C Ar N 242Checkpoint the queue file after every 243.Ar N 244successful deliveries (default 10). 245This avoids excessive duplicate deliveries 246when sending to long mailing lists 247interrupted by system crashes. 248.ne 1i 249.It Li d Ns Ar x 250Set the delivery mode to 251.Ar x . 252Delivery modes are 253.Ql i 254for interactive (synchronous) delivery, 255.Ql b 256for background (asynchronous) delivery, 257and 258.Ql q 259for queue only \- i.e., 260actual delivery is done the next time the queue is run. 261.It Li D 262Try to automatically rebuild the alias database 263if necessary. 264.It Li e Ns Ar x 265Set error processing to mode 266.Ar x . 267Valid modes are 268.Ql m 269to mail back the error message, 270.Ql w 271to ``write'' back the error message 272(or mail it back if the sender is not logged in), 273.Ql p 274to print the errors on the terminal 275(default), 276.Ql q 277to throw away error messages 278(only exit status is returned), 279and 280.Ql e 281to do special processing for the BerkNet. 282If the text of the message is not mailed back 283by 284modes 285.Ql m 286or 287.Ql w 288and if the sender is local to this machine, 289a copy of the message is appended to the file 290.Pa dead.letter 291in the sender's home directory. 292.It Li f 293Save 294.Tn UNIX Ns \-style 295From lines at the front of messages. 296.It Li G 297Match local mail names against the GECOS portion of the password file. 298.It Li g Ar N 299The default group id to use when calling mailers. 300.It Li H Ns Ar file 301The 302.Tn SMTP 303help file. 304.It Li h Ar N 305The maximum number of times a message is allowed to ``hop'' 306before we decide it is in a loop. 307.It Li i 308Do not take dots on a line by themselves 309as a message terminator. 310.It Li j 311Send error messages in MIME format. 312.It Li K Ns Ar timeout 313Set connection cache timeout. 314.It Li k Ns Ar N 315Set connection cache size. 316.It Li L Ns Ar n 317The log level. 318.It Li l 319Pay attention to the Errors-To: header. 320.It Li m 321Send to ``me'' (the sender) also if I am in an alias expansion. 322.It Li n 323Validate the right hand side of aliases during a 324.Xr newaliases 1 325command. 326.It Li o 327If set, this message may have 328old style headers. 329If not set, 330this message is guaranteed to have new style headers 331(i.e., commas instead of spaces between addresses). 332If set, an adaptive algorithm is used that will correctly 333determine the header format in most cases. 334.It Li Q Ns Ar queuedir 335Select the directory in which to queue messages. 336.It Li S Ns Ar file 337Save statistics in the named file. 338.It Li s 339Always instantiate the queue file, 340even under circumstances where it is not strictly necessary. 341This provides safety against system crashes during delivery. 342.It Li T Ns Ar time 343Set the timeout on undelivered messages in the queue to the specified time. 344After delivery has failed 345(e.g., because of a host being down) 346for this amount of time, 347failed messages will be returned to the sender. 348The default is three days. 349.It Li t Ns Ar stz , Ar dtz 350Set the name of the time zone. 351.It Li U Ns Ar userdatabase 352If set, a user database is consulted to get forwarding information. 353You can consider this an adjunct to the aliasing mechanism, 354except that the database is intended to be distributed; 355aliases are local to a particular host. 356This may not be available if your sendmail does not have the 357.Dv USERDB 358option compiled in. 359.It Li u Ns Ar N 360Set the default user id for mailers. 361.It Li Y 362Fork each job during queue runs. 363May be convenient on memory-poor machines. 364.It Li 7 365Strip incoming messages to seven bits. 366.El 367.Pp 368In aliases, 369the first character of a name may be 370a vertical bar to cause interpretation of 371the rest of the name as a command 372to pipe the mail to. 373It may be necessary to quote the name 374to keep 375.Nm sendmail 376from suppressing the blanks from between arguments. 377For example, a common alias is: 378.Pp 379.Bd -literal -offset indent -compact 380msgs: "|/usr/bin/msgs -s" 381.Ed 382.Pp 383Aliases may also have the syntax 384.Dq :include: Ns Ar filename 385to ask 386.Xr sendmail 387to read the named file for a list of recipients. 388For example, an alias such as: 389.Pp 390.Bd -literal -offset indent -compact 391poets: ":include:/usr/local/lib/poets.list" 392.Ed 393.Pp 394would read 395.Pa /usr/local/lib/poets.list 396for the list of addresses making up the group. 397.Pp 398.Nm Sendmail 399returns an exit status 400describing what it did. 401The codes are defined in 402.Aq Pa sysexits.h : 403.Bl -tag -width EX_UNAVAILABLE -compact -offset indent 404.It Dv EX_OK 405Successful completion on all addresses. 406.It Dv EX_NOUSER 407User name not recognized. 408.It Dv EX_UNAVAILABLE 409Catchall meaning necessary resources 410were not available. 411.It Dv EX_SYNTAX 412Syntax error in address. 413.It Dv EX_SOFTWARE 414Internal software error, 415including bad arguments. 416.It Dv EX_OSERR 417Temporary operating system error, 418such as 419.Dq cannot fork . 420.It Dv EX_NOHOST 421Host name not recognized. 422.It Dv EX_TEMPFAIL 423Message could not be sent immediately, 424but was queued. 425.El 426.Pp 427If invoked as 428.Nm newaliases , 429.Nm sendmail 430will rebuild the alias database. 431If invoked as 432.Nm mailq , 433.Nm sendmail 434will print the contents of the mail queue. 435.Sh FILES 436Except for the file 437.Pa /etc/sendmail.cf 438itself, 439the following pathnames are all specified in 440.Pa /etc/sendmail.cf. 441Thus, 442these values are only approximations. 443.Pp 444.Bl -tag -width /usr/lib/sendmail.fc -compact 445.It Pa /etc/aliases 446raw data for alias names 447.It Pa /etc/aliases.db 448data base of alias names 449.It Pa /etc/sendmail.cf 450configuration file 451.It Pa /etc/sendmail.hf 452help file 453.It Pa /var/log/sendmail.st 454collected statistics 455.It Pa /var/spool/mqueue/* 456temp files 457.It Pa /var/run/sendmail.pid 458The process id of the daemon 459.El 460.Sh SEE ALSO 461.Xr binmail 1 , 462.Xr mail 1 , 463.Xr rmail 1 , 464.Xr syslog 3 , 465.Xr aliases 5 , 466.Xr mailaddr 7 , 467.Xr rc 8 ; 468.Pp 469DARPA 470Internet Request For Comments 471.%T RFC819 , 472.%T RFC821 , 473.%T RFC822 . 474.Rs 475.%T "Sendmail \- An Internetwork Mail Router" 476.%V SMM 477.%N \&No. 9 478.Re 479.Rs 480.%T "Sendmail Installation and Operation Guide" 481.%V SMM 482.%N \&No. 8 483.Re 484.Sh HISTORY 485The 486.Nm 487command appeared in 488.Bx 4.2 . 489