Standards, Environments, and Macros dot-qmail(5) NNNNAAAAMMMMEEEE dot-qmail - control the delivery of mail messages DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN Normally the qqqqmmmmaaaaiiiillll----llllooooccccaaaallll program delivers each incoming mes- sage to your system mailbox, _h_o_m_e_d_i_r////MMMMaaaaiiiillllbbbbooooxxxx, where _h_o_m_e_d_i_r is your home directory. It can instead write the mail to a different file or direc- tory, forward it to another address, distribute it to a mailing list, or even execute programs, all under your con- trol. TTTTHHHHEEEE QQQQMMMMAAAAIIIILLLL FFFFIIIILLLLEEEE To change qqqqmmmmaaaaiiiillll----llllooooccccaaaallll's behavior, set up a ....qqqqmmmmaaaaiiiillll file in your home directory. ....qqqqmmmmaaaaiiiillll contains one or more lines. Each line is a delivery instruction. qqqqmmmmaaaaiiiillll----llllooooccccaaaallll follows each instruction in turn. There are five types of delivery instructions: (1) comment; (2) program; (3) forward; (4) mbox; (5) maildir. (1) A comment line begins with a number sign: # this is a comment qqqqmmmmaaaaiiiillll----llllooooccccaaaallll ignores the line. (2) A program line begins with a vertical bar: |preline /usr/ucb/vacation djb qqqqmmmmaaaaiiiillll----llllooooccccaaaallll takes the rest of the line as a command to supply to sssshhhh. See qqqqmmmmaaaaiiiillll----ccccoooommmmmmmmaaaannnndddd((((8888)))) for further infor- mation. (3) A forward line begins with an ampersand: &me@new.job.com qqqqmmmmaaaaiiiillll----llllooooccccaaaallll takes the rest of the line as a mail address; it uses qqqqmmmmaaaaiiiillll----qqqquuuueeeeuuuueeee to forward the message to that address. The address must contain a fully quali- fied domain name; it must not contain extra spaces, angle brackets, or comments: # the following examples are WRONG &me@new & & me@new.job.com &me@new.job.com (New Address) SunOS 5.11 Last change: 1 Standards, Environments, and Macros dot-qmail(5) If the address begins with a letter or number, you may leave out the ampersand: me@new.job.com Note that qqqqmmmmaaaaiiiillll----llllooooccccaaaallll omits its new RRRReeeettttuuuurrrrnnnn----PPPPaaaatttthhhh line when forwarding messages. (4) An _m_b_o_x line begins with a slash or dot, and does not end with a slash: /home/djb/Mailbox.sos qqqqmmmmaaaaiiiillll----llllooooccccaaaallll takes the entire line as a filename. It appends the mail message to that file, using fffflllloooocccckkkk- style file locking if possible. qqqqmmmmaaaaiiiillll----llllooooccccaaaallll stores the mail message in _m_b_o_x format, as described in mmmmbbbbooooxxxx((((5555)))). WWWWAAAARRRRNNNNIIIINNNNGGGG:::: On many systems, anyone who can read a file can fffflllloooocccckkkk it, and thus hold up qqqqmmmmaaaaiiiillll----llllooooccccaaaallll's delivery forever. Do not deliver mail to a publicly accessible file! If qqqqmmmmaaaaiiiillll----llllooooccccaaaallll is able to lock the file, but has trou- ble writing to it (because, for example, the disk is full), it will truncate the file back to its original length. However, it cannot prevent mailbox corruption if the system crashes during delivery. (5) A _m_a_i_l_d_i_r line begins with a slash or dot, and ends with a slash: /home/djb/Maildir/ qqqqmmmmaaaaiiiillll----llllooooccccaaaallll takes the entire line as the name of a directory in _m_a_i_l_d_i_r format. It reliably stores the incoming message in that directory. See mmmmaaaaiiiillllddddiiiirrrr((((5555)))) for more details. If ....qqqqmmmmaaaaiiiillll has the execute bit set, it must not contain any program lines, _m_b_o_x lines, or _m_a_i_l_d_i_r lines. If qqqqmmmmaaaaiiiillll----llllooooccccaaaallll sees any such lines, it will stop and indicate a temporary failure. If ....qqqqmmmmaaaaiiiillll is completely empty (0 bytes long), or does not exist, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll follows the _d_e_f_a_u_l_t_d_e_l_i_v_e_r_y instructions set by your system administrator; normally _d_e_f_a_u_l_t_d_e_l_i_v_e_r_y is ....////MMMMaaaaiiiillllbbbbooooxxxx, so qqqqmmmmaaaaiiiillll----llllooooccccaaaallll appends the mail message to MMMMaaaaiiiillllbbbbooooxxxx in _m_b_o_x format. ....qqqqmmmmaaaaiiiillll may contain extra spaces and tabs at the end of a line. Blank lines are allowed, but not for the first line SunOS 5.11 Last change: 2 Standards, Environments, and Macros dot-qmail(5) of ....qqqqmmmmaaaaiiiillll. If ....qqqqmmmmaaaaiiiillll is world-writable, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll stops and indicates a temporary failure. SSSSAAAAFFFFEEEE QQQQMMMMAAAAIIIILLLL EEEEDDDDIIIITTTTIIIINNNNGGGG Incoming messages can arrive at any moment. If you want to safely edit your ....qqqqmmmmaaaaiiiillll file, first set the sticky bit on your home directory: chmod +t $HOME qqqqmmmmaaaaiiiillll----llllooooccccaaaallll will temporarily defer delivery of any message to you if your home directory is sticky (or group-writable or other-writable, which should never happen). Make sure to chmod -t $HOME when you are done! It's a good idea to test your new ....qqqqmmmmaaaaiiiillll file as follows: qmail-local -n $USER ~ $USER '' '' '' '' ./Mailbox EEEEXXXXTTTTEEEENNNNSSSSIIIIOOOONNNN AAAADDDDDDDDRRRREEEESSSSSSSSEEEESSSS In the qqqqmmmmaaaaiiiillll system, you control all local addresses of the form _u_s_e_r----_a_n_y_t_h_i_n_g, as well as the address _u_s_e_r itself, where _u_s_e_r is your account name. Delivery to _u_s_e_r----_a_n_y_t_h_i_n_g is controlled by the file _h_o_m_e_d_i_r/....qqqqmmmmaaaaiiiillll-_a_n_y_t_h_i_n_g. (These rules may be changed by the system administrator; see qqqqmmmmaaaaiiiillll----uuuusssseeeerrrrssss(5).) The aaaalllliiiiaaaassss user controls all other addresses. Delivery to _l_o_c_a_l is controlled by the file _h_o_m_e_d_i_r/....qqqqmmmmaaaaiiiillll-_l_o_c_a_l, where _h_o_m_e_d_i_r is aaaalllliiiiaaaassss's home directory. In the following description, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll is handling a mes- sage addressed to _l_o_c_a_l@_d_o_m_a_i_n, where _l_o_c_a_l is controlled by ....qqqqmmmmaaaaiiiillll-_e_x_t. Here is what it does. If ....qqqqmmmmaaaaiiiillll-_e_x_t is completely empty, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll follows the _d_e_f_a_u_l_t_d_e_l_i_v_e_r_y instructions set by your system administra- tor. If ....qqqqmmmmaaaaiiiillll-_e_x_t doesn't exist, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll will try some default ....qqqqmmmmaaaaiiiillll files. For example, if _e_x_t is ffffoooooooo----bbbbaaaarrrr, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll will try first ....qqqqmmmmaaaaiiiillll----ffffoooooooo----bbbbaaaarrrr, then ....qqqqmmmmaaaaiiiillll----ffffoooooooo---- ddddeeeeffffaaaauuuulllltttt, and finally ....qqqqmmmmaaaaiiiillll----ddddeeeeffffaaaauuuulllltttt. If none of these exist, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll will bounce the message. (Exception: for the basic _u_s_e_r address, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll treats a nonexistent ....qqqqmmmmaaaaiiiillll the same as an empty ....qqqqmmmmaaaaiiiillll.) WWWWAAAARRRRNNNNIIIINNNNGGGG:::: For security, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll replaces any dots in _e_x_t SunOS 5.11 Last change: 3 Standards, Environments, and Macros dot-qmail(5) with colons before checking ....qqqqmmmmaaaaiiiillll-_e_x_t. For convenience, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll converts any uppercase letters in _e_x_t to lower- case. When qqqqmmmmaaaaiiiillll----llllooooccccaaaallll forwards a message as instructed in ....qqqqmmmmaaaaiiiillll-_e_x_t (or ....qqqqmmmmaaaaiiiillll----ddddeeeeffffaaaauuuulllltttt), it checks whether ....qqqqmmmmaaaaiiiillll-_e_x_t----oooowwwwnnnneeeerrrr exists. If so, it uses _l_o_c_a_l----oooowwwwnnnneeeerrrr@@@@_d_o_m_a_i_n as the envelope sender for the forwarded message. Otherwise it retains the envelope sender of the original message. Exception: qqqqmmmmaaaaiiiillll----llllooooccccaaaallll always retains the original envelope sender if it is the empty address or ####@@@@[[[[]]]], i.e., if this is a bounce message. qqqqmmmmaaaaiiiillll----llllooooccccaaaallll also supports vvvvaaaarrrriiiiaaaabbbblllleeee eeeennnnvvvveeeellllooooppppeeee rrrreeeettttuuuurrrrnnnn ppppaaaatttthhhhssss (VERPs): if ....qqqqmmmmaaaaiiiillll-_e_x_t----oooowwwwnnnneeeerrrr and ....qqqqmmmmaaaaiiiillll-_e_x_t----oooowwwwnnnneeeerrrr----ddddeeeeffffaaaauuuulllltttt both exist, it uses _l_o_c_a_l-oooowwwwnnnneeeerrrr-@@@@_d_o_m_a_i_n----@@@@[[[[]]]] as the envelope sender. This will cause a recipient _r_e_c_i_p@@@@_r_e_c_i_p_h_o_s_t to see an envelope sender of _l_o_c_a_l-oooowwwwnnnneeeerrrr-_r_e_c_i_p====_r_e_c_i_p_h_o_s_t@@@@_d_o_m_a_i_n. EEEERRRRRRRROOOORRRR HHHHAAAANNNNDDDDLLLLIIIINNNNGGGG If a delivery instruction fails, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll stops immedi- ately and reports failure. qqqqmmmmaaaaiiiillll----llllooooccccaaaallll handles forwarding after all other instructions, so any error in another type of delivery will prevent all forwarding. If a program returns exit code 99, qqqqmmmmaaaaiiiillll----llllooooccccaaaallll ignores all succeeding lines in ....qqqqmmmmaaaaiiiillll, but it still pays attention to previous forward lines. To set up independent instructions, where a temporary or permanent failure in one instruction does not affect the others, move each instruction into a separate ....qqqqmmmmaaaaiiiillll-_e_x_t file, and set up a central ....qqqqmmmmaaaaiiiillll file that forwards to all of the ....qqqqmmmmaaaaiiiillll-_e_x_ts. Note that qqqqmmmmaaaaiiiillll----llllooooccccaaaallll can handle any number of forward lines simultaneously. SSSSEEEEEEEE AAAALLLLSSSSOOOO envelopes(5), maildir(5), mbox(5), qmail-users(5), qmail- local(8), qmail-command(8), qmail-queue(8), qmail-lspawn(8) SunOS 5.11 Last change: 4