1.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved. 2.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved. 3.\" Copyright (c) 1988, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" By using this file, you agree to the terms and conditions set 7.\" forth in the LICENSE file which can be found at the top level of 8.\" the sendmail distribution. 9.\" 10.\" 11.\" @(#)sendmail.8 8.20 (Berkeley) 8/2/1998 12.\" 13.Dd August 2, 1998 14.Dt SENDMAIL 8 15.Os BSD 4 16.Sh NAME 17.Nm sendmail 18.Nd an electronic mail transport agent 19.Sh SYNOPSIS 20.Nm sendmail 21.Op Ar flags 22.Op Ar address ... 23.Nm newaliases 24.Nm mailq 25.Op Fl v 26.Sh DESCRIPTION 27.Nm Sendmail 28sends a message to one or more 29.Em recipients , 30routing the message over whatever networks 31are necessary. 32.Nm Sendmail 33does internetwork forwarding as necessary 34to deliver the message to the correct place. 35.Pp 36.Nm Sendmail 37is not intended as a user interface routine; 38other programs provide user-friendly 39front ends; 40.Nm sendmail 41is used only to deliver pre-formatted messages. 42.Pp 43With no flags, 44.Nm sendmail 45reads its standard input 46up to an end-of-file 47or a line consisting only of a single dot 48and sends a copy of the message found there 49to all of the addresses listed. 50It determines the network(s) to use 51based on the syntax and contents of the addresses. 52.Pp 53Local addresses are looked up in a file 54and aliased appropriately. 55Aliasing can be prevented by preceding the address 56with a backslash. 57Normally the sender is not included in any alias 58expansions, e.g., 59if `john' sends to `group', 60and `group' includes `john' in the expansion, 61then the letter will not be delivered to `john'. 62.Ss Parameters 63.Bl -tag -width Fl 64.It Fl B Ns Ar type 65Set the body type to 66.Ar type . 67Current legal values 68.Li 7BIT 69or 70.Li 8BITMIME . 71.It Fl ba 72Go into 73.Tn ARPANET 74mode. 75All input lines must end with a CR-LF, 76and all messages will be generated with a CR-LF at the end. 77Also, 78the ``From:'' and ``Sender:'' 79fields are examined for the name of the sender. 80.It Fl bd 81Run as a daemon. This requires Berkeley 82.Tn IPC . 83.Nm Sendmail 84will fork and run in background 85listening on socket 25 for incoming 86.Tn SMTP 87connections. 88This is normally run from 89.Pa /etc/rc . 90.It Fl bD 91Same as 92.Fl bd 93except runs in foreground. 94.It Fl bh 95Print the persistent host status database. 96.It Fl bH 97Purge the persistent host status database. 98.It Fl bi 99Initialize the alias database. 100.It Fl bm 101Deliver mail in the usual way (default). 102.It Fl bp 103Print a listing of the queue. 104.It Fl bs 105Use the 106.Tn SMTP 107protocol as described in 108.Tn RFC821 109on standard input and output. 110This flag implies all the operations of the 111.Fl ba 112flag that are compatible with 113.Tn SMTP . 114.It Fl bt 115Run in address test mode. 116This mode reads addresses and shows the steps in parsing; 117it is used for debugging configuration tables. 118.It Fl bv 119Verify names only \- do not try to collect or deliver a message. 120Verify mode is normally used for validating 121users or mailing lists. 122.It Fl C Ns Ar file 123Use alternate configuration file. 124.Nm Sendmail 125refuses to run as root if an alternate configuration file is specified. 126.It Fl d Ns Ar X 127Set debugging value to 128.Ar X . 129.ne 1i 130.It Fl F Ns Ar fullname 131Set the full name of the sender. 132.It Fl f Ns Ar name 133Sets the name of the ``from'' person 134(i.e., the sender of the mail). 135.Fl f 136can only be used 137by ``trusted'' users 138(normally 139.Em root , 140.Em daemon , 141and 142.Em network ) 143or if the person you are trying to become 144is the same as the person you are. 145.It Fl h Ns Ar N 146Set the hop count to 147.Ar N . 148The hop count is incremented every time the mail is 149processed. 150When it reaches a limit, 151the mail is returned with an error message, 152the victim of an aliasing loop. 153If not specified, 154``Received:'' lines in the message are counted. 155.It Fl i 156Ignore dots alone on lines by themselves in incoming messages. 157This should be set if you are reading data from a file. 158.It Fl N Ar dsn 159Set delivery status notification conditions to 160.Ar dsn, 161which can be 162.Ql never 163for no notifications 164or a comma separated list of the values 165.Ql failure 166to be notified if delivery failed, 167.Ql delay 168to be notified if delivery is delayed, and 169.Ql success 170to be notified when the message is successfully delivered. 171.It Fl n 172Don't do aliasing. 173.It Fl O Ar option Ns = Ns Em value 174Set option 175.Ar option 176to the specified 177.Em value . 178This form uses long names. 179See below for more details. 180.It Fl o Ns Ar x Em value 181Set option 182.Ar x 183to the specified 184.Em value . 185This form uses single character names only. 186The short names are not described in this manual page; 187see the 188.%T "Sendmail Installation and Operation Guide" 189for details. 190.It Fl p Ns Ar protocol 191Set the name of the protocol used to receive the message. 192This can be a simple protocol name such as ``UUCP'' 193or a protocol and hostname, such as ``UUCP:ucbvax''. 194.It Fl q Ns Bq Ar time 195Processed saved messages in the queue at given intervals. 196If 197.Ar time 198is omitted, 199process the queue once. 200.Xr Time 201is given as a tagged number, 202with 203.Ql s 204being seconds, 205.Ql m 206being minutes, 207.Ql h 208being hours, 209.Ql d 210being days, 211and 212.Ql w 213being weeks. 214For example, 215.Ql \-q1h30m 216or 217.Ql \-q90m 218would both set the timeout to one hour thirty minutes. 219If 220.Ar time 221is specified, 222.Nm sendmail 223will run in background. 224This option can be used safely with 225.Fl bd . 226.It Fl qI Ns Ar substr 227Limit processed jobs to those containing 228.Ar substr 229as a substring of the queue id. 230.It Fl qR Ns Ar substr 231Limit processed jobs to those containing 232.Ar substr 233as a substring of one of the recipients. 234.It Fl qS Ns Ar substr 235Limit processed jobs to those containing 236.Ar substr 237as a substring of the sender. 238.It Fl R Ar return 239Set the amount of the message to be returned 240if the message bounces. 241The 242.Ar return 243parameter can be 244.Ql full 245to return the entire message or 246.Ql hdrs 247to return only the headers. 248.It Fl r Ns Ar name 249An alternate and obsolete form of the 250.Fl f 251flag. 252.It Fl t 253Read message for recipients. 254To:, Cc:, and Bcc: lines will be scanned for recipient addresses. 255The Bcc: line will be deleted before transmission. 256.It Fl U 257Initial (user) submission. 258This should 259.Em always 260be set when called from a user agent such as 261.Nm Mail 262or 263.Nm exmh 264and 265.Em never 266be set when called by a network delivery agent such as 267.Nm rmail . 268.It Fl V Ar envid 269Set the original envelope id. 270This is propagated across SMTP to servers that support DSNs 271and is returned in DSN-compliant error messages. 272.It Fl v 273Go into verbose mode. 274Alias expansions will be announced, etc. 275.It Fl X Ar logfile 276Log all traffic in and out of mailers in the indicated log file. 277This should only be used as a last resort 278for debugging mailer bugs. 279It will log a lot of data very quickly. 280.It Fl - 281Stop processing command flags and use the rest of the arguments 282as addresses. 283.El 284.Ss Options 285There are also a number of processing options that may be set. 286Normally these will only be used by a system administrator. 287Options may be set either on the command line 288using the 289.Fl o 290flag (for short names), 291the 292.Fl O 293flag (for long names), 294or in the configuration file. 295This is a partial list limited to those options that are likely to be useful 296on the command line 297and only shows the long names; 298for a complete list (and details), consult the 299.%T "Sendmail Installation and Operation Guide" . 300The options are: 301.Bl -tag -width Fl 302.It Li AliasFile= Ns Ar file 303Use alternate alias file. 304.It Li HoldExpensive 305On mailers that are considered ``expensive'' to connect to, 306don't initiate immediate connection. 307This requires queueing. 308.It Li CheckpointInterval= Ns Ar N 309Checkpoint the queue file after every 310.Ar N 311successful deliveries (default 10). 312This avoids excessive duplicate deliveries 313when sending to long mailing lists 314interrupted by system crashes. 315.ne 1i 316.It Li DeliveryMode= Ns Ar x 317Set the delivery mode to 318.Ar x . 319Delivery modes are 320.Ql i 321for interactive (synchronous) delivery, 322.Ql b 323for background (asynchronous) delivery, 324.Ql q 325for queue only \- i.e., 326actual delivery is done the next time the queue is run, and 327.Ql d 328for deferred \- the same as 329.Ql q 330except that database lookups (notably DNS and NIS lookups) are avoided. 331.It Li ErrorMode= Ns Ar x 332Set error processing to mode 333.Ar x . 334Valid modes are 335.Ql m 336to mail back the error message, 337.Ql w 338to ``write'' back the error message 339(or mail it back if the sender is not logged in), 340.Ql p 341to print the errors on the terminal 342(default), 343.Ql q 344to throw away error messages 345(only exit status is returned), 346and 347.Ql e 348to do special processing for the BerkNet. 349If the text of the message is not mailed back 350by 351modes 352.Ql m 353or 354.Ql w 355and if the sender is local to this machine, 356a copy of the message is appended to the file 357.Pa dead.letter 358in the sender's home directory. 359.It Li SaveFromLine 360Save 361.Tn UNIX Ns \-style 362From lines at the front of messages. 363.It Li MaxHopCount= Ar N 364The maximum number of times a message is allowed to ``hop'' 365before we decide it is in a loop. 366.It Li IgnoreDots 367Do not take dots on a line by themselves 368as a message terminator. 369.It Li SendMimeErrors 370Send error messages in MIME format. 371If not set, the DSN (Delivery Status Notification) SMTP extension 372is disabled. 373.It Li ConnectionCacheTimeout= Ns Ar timeout 374Set connection cache timeout. 375.It Li ConnectionCacheSize= Ns Ar N 376Set connection cache size. 377.It Li LogLevel= Ns Ar n 378The log level. 379.It Li MeToo 380Send to ``me'' (the sender) also if I am in an alias expansion. 381.It Li CheckAliases 382Validate the right hand side of aliases during a 383.Xr newaliases 1 384command. 385.It Li OldStyleHeaders 386If set, this message may have 387old style headers. 388If not set, 389this message is guaranteed to have new style headers 390(i.e., commas instead of spaces between addresses). 391If set, an adaptive algorithm is used that will correctly 392determine the header format in most cases. 393.It Li QueueDirectory= Ns Ar queuedir 394Select the directory in which to queue messages. 395.It Li StatusFile= Ns Ar file 396Save statistics in the named file. 397.It Li Timeout.queuereturn= Ns Ar time 398Set the timeout on undelivered messages in the queue to the specified time. 399After delivery has failed 400(e.g., because of a host being down) 401for this amount of time, 402failed messages will be returned to the sender. 403The default is five days. 404.It Li UserDatabaseSpec= Ns Ar userdatabase 405If set, a user database is consulted to get forwarding information. 406You can consider this an adjunct to the aliasing mechanism, 407except that the database is intended to be distributed; 408aliases are local to a particular host. 409This may not be available if your sendmail does not have the 410.Dv USERDB 411option compiled in. 412.It Li ForkEachJob 413Fork each job during queue runs. 414May be convenient on memory-poor machines. 415.It Li SevenBitInput 416Strip incoming messages to seven bits. 417.It Li EightBitMode= Ns Ar mode 418Set the handling of eight bit input to seven bit destinations to 419.Ar mode : 420.Li m 421(mimefy) will convert to seven-bit MIME format, 422.Li p 423(pass) will pass it as eight bits (but violates protocols), 424and 425.Li s 426(strict) will bounce the message. 427.It Li MinQueueAge= Ns Ar timeout 428Sets how long a job must ferment in the queue between attempts to send it. 429.It Li DefaultCharSet= Ns Ar charset 430Sets the default character set used to label 8-bit data 431that is not otherwise labelled. 432.It Li DialDelay= Ns Ar sleeptime 433If opening a connection fails, 434sleep for 435.Ar sleeptime 436seconds and try again. 437Useful on dial-on-demand sites. 438.It Li NoRecipientAction= Ns Ar action 439Set the behaviour when there are no recipient headers (To:, Cc: or Bcc:) 440in the message to 441.Ar action : 442.Li none 443leaves the message unchanged, 444.Li add-to 445adds a To: header with the envelope recipients, 446.Li add-apparently-to 447adds an Apparently-To: header with the envelope recipients, 448.Li add-bcc 449adds an empty Bcc: header, and 450.Li add-to-undisclosed 451adds a header reading 452.Ql "To: undisclosed-recipients:;" . 453.It Li MaxDaemonChildren= Ns Ar N 454Sets the maximum number of children that an incoming SMTP daemon 455will allow to spawn at any time to 456.Ar N . 457.It Li ConnectionRateThrottle= Ns Ar N 458Sets the maximum number of connections per second to the SMTP port to 459.Ar N . 460.El 461.Pp 462In aliases, 463the first character of a name may be 464a vertical bar to cause interpretation of 465the rest of the name as a command 466to pipe the mail to. 467It may be necessary to quote the name 468to keep 469.Nm sendmail 470from suppressing the blanks from between arguments. 471For example, a common alias is: 472.Pp 473.Bd -literal -offset indent -compact 474msgs: "|/usr/bin/msgs -s" 475.Ed 476.Pp 477Aliases may also have the syntax 478.Dq :include: Ns Ar filename 479to ask 480.Xr sendmail 481to read the named file for a list of recipients. 482For example, an alias such as: 483.Pp 484.Bd -literal -offset indent -compact 485poets: ":include:/usr/local/lib/poets.list" 486.Ed 487.Pp 488would read 489.Pa /usr/local/lib/poets.list 490for the list of addresses making up the group. 491.Pp 492.Nm Sendmail 493returns an exit status 494describing what it did. 495The codes are defined in 496.Aq Pa sysexits.h : 497.Bl -tag -width EX_UNAVAILABLE -compact -offset indent 498.It Dv EX_OK 499Successful completion on all addresses. 500.It Dv EX_NOUSER 501User name not recognized. 502.It Dv EX_UNAVAILABLE 503Catchall meaning necessary resources 504were not available. 505.It Dv EX_SYNTAX 506Syntax error in address. 507.It Dv EX_SOFTWARE 508Internal software error, 509including bad arguments. 510.It Dv EX_OSERR 511Temporary operating system error, 512such as 513.Dq cannot fork . 514.It Dv EX_NOHOST 515Host name not recognized. 516.It Dv EX_TEMPFAIL 517Message could not be sent immediately, 518but was queued. 519.El 520.Pp 521If invoked as 522.Nm newaliases , 523.Nm sendmail 524will rebuild the alias database. 525If invoked as 526.Nm mailq , 527.Nm sendmail 528will print the contents of the mail queue. 529.Sh FILES 530Except for the file 531.Pa /etc/sendmail.cf 532itself and the daemon process ID file, 533the following pathnames are all specified in 534.Pa /etc/sendmail.cf. 535Thus, 536these values are only approximations. 537.Pp 538.Bl -tag -width /usr/lib/sendmail.fc -compact 539.It Pa /etc/aliases 540raw data for alias names 541.It Pa /etc/aliases.db 542data base of alias names 543.It Pa /etc/sendmail.cf 544configuration file 545.It Pa /usr/share/misc/sendmail.hf 546help file 547.It Pa /var/log/sendmail.st 548collected statistics 549.It Pa /var/spool/mqueue/* 550temp files 551.El 552.Sh SEE ALSO 553.Xr mail 1 , 554.Xr syslog 3 , 555.Xr aliases 5 , 556.Xr mailaddr 7 , 557.Xr mail.local 8 , 558.Xr rc 8 , 559.Xr rmail 8 ; 560.Pp 561DARPA 562Internet Request For Comments 563.%T RFC819 , 564.%T RFC821 , 565.%T RFC822 . 566.Rs 567.%T "Sendmail \- An Internetwork Mail Router" 568.%V SMM 569.%N \&No. 9 570.Re 571.Rs 572.%T "Sendmail Installation and Operation Guide" 573.%V SMM 574.%N \&No. 8 575.Re 576.Sh HISTORY 577The 578.Nm 579command appeared in 580.Bx 4.2 . 581