[ Current Issue Home | Issue #5/6 Home | FAQ ]��

The FreeBSD 'zine
Featured Articles: qmail
## 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 [email protected] 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
	#
	&[email protected]
  

That's it; now all mail for bob is forwarded to [email protected]. 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
	[email protected]
	[email protected]
	[email protected]
  

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
	[email protected]
	[email protected]
	[email protected]
	| 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

Return to Issue #5

Contact: <>
Last modified: $Date: 1999/06/26 05:42:52 $
Copyright � 2023, The FreeBSD 'zine
All rights reserved.