## qmail: the .qmail file ## Nathan Underwood Intro The .qmail file in your home directory is your greatest ally in the fight to control your incoming mail. The .qmail file is similar to a .forward file in sendmail, but can do even more. This tutorial will be a bit shorter than the last few due to my starting a new job this week and moving to a new city, but I hope that you will find it as helpful as the last articles. Functions You will likely notice that by default, there is no .qmail file in your home directory. qmail-local, the program that actually puts you incoming mail in you Mailbox file, automatically sends all incoming mail to homedir/Mailbox, where "homedir" is your home directory. So, if you simply want all mail to come to you as is, you don't really need a .qmail file. But, for all others (forwards, sending to multiple boxes, etc.), the .qmail file is essential. Here are the 3 most common uses: Forwards A forward line in your .qmail file will begin with an "&". Say I want all mail for user bob to go to bob@somedomain.com instead of his mailbox on the machine. To do this I would create a .qmail file in bob's home directory and add the line: # # .qmail for user bob - forward # &bob@somedomain.com That's it; now all mail for bob is forwarded to bob@somedomain.com. Keep in mind that if you want mail delivered to many email boxes, you do not want to use the "&" in front of the recipients. Multiple Recipients To have your local mail delivered to multiple recipients, the syntax is extremely easy. You will simple need to add those recipient's email addresses to the .qmail file. Continuing with user bob: # # .qmail for user bob - multiple recipients # /homedir/Mailbox joe@somedomain.com billy@somedomain.com gonzo@somedomain.com This delivers the mail for user bob to his local mailbox, and also to the 3 other recipients. Programs Say I wanted the program qbiff (a mail notifier) to run every time mail was delivered to my local box. To do this I would create a 2 line .qmail file (still using our example user bob) like this: # # .qmail for user bob - local delivery with a program # /home/bob/Mailbox | qbiff> This tells qmail-local to deliver all incoming mail to user bob's local box, and then run the program qbiff. The | is the mechanism for initiating a program. Putting it all together So, let's put bob's qmail file together. Lets say that we want mail to be delivered to bob's local box, we want it sent to 3 other places, and we want bob to be notified by qbiff when new mail has arrived. Here is bob's .qmail file: # # .qmail for user bob # /homedir/Mailbox bob@somedomain.com jim@somedomain.com ralph@somedomain.com | qbiff Closing That's it. While there are more uses for the .qmail file, these are probably the most commonly used. I would recommend reading the dot-qmail man page to get the whole scoop. So, until next time, when we discuss using qmail with multiple domains, happy qmailing! Nathan Underwood $Id: qmail.txt,v 1.1 2000/02/16 08:07:52 jim Exp $