Configuring procmail with The Dotfile Generator

Here's a follow-up article on TDG to show you the easy way to configure the procmail program.
3. The Reply Action

With the reply action you can set up a reply mechanism, which sends a letter back to the sender with a message that you specify. One feature of this mechanism is that you can specify how often a reply should be sent. You have the following choices:

  • Send a reply to each letter.

  • Send a reply only once.

  • Send a reply only if it is more than a given number of days since the last reply was sent.

This action is useful if you leave on vacation, and wish to send a message that you will not read your letter at once.

The reply is sent only if the letter does not come from a daemon, to avoid sending a reply to every message on a mailing list.

4. The Forward Action

With the forward action, you may forward letters to other e-mail accounts.

5. The Save to File Action

With this action, you can save the letter to a file. The file name is specified with a FillOut widget, just as you specified the name of a file for backups. This time, however, you have two additional features: you can use the content of a header field, or you can use the output from a command. In Figure 5, you can see how to select a header field to extract as part of the file name.

Figure 5. Header Field Selection

E-mail addresses can be specified in three ways:

  • real name (e-mail)

  • e-mail (real name)

  • e-mail

If you specify that the field is an e-mail address, you may also specify whether you wish to extract the user name with or without the domain name.

Finally, you can pipe the header field though a specified command. This command can read the value of the header field on standard input and write to standard output.

6. The Pipe Action

With the pipe action, you can specify a command to take care of the letter. This command can read the letter on standard input but cannot write anything (it is ignored).

The Log File

The procmail file generated from TDG contains lots of comments to make it easy for you to find a specific recipe.

Should something go wrong, you may turn on the extended diagnostic option. This will write additional lines to the log file to show you what it does. For debugging, you must read both the log file and the procmail file.

If you use the log abstract options, you will find the program mailstat very useful. It tells you how many letters have been delivered where. One line in the output from the mailstat programs is fake: /bin/false--it may be safely ignored. When you wish to delete a letter in a way that you can explicitly see that it has been removed, you should deliver it to the file called /dev/null. Please note that you can only use the mailstat program if the extended diagnostic option is turned off.

The End

Before procmail starts filtering all your incoming mail, you must add the following line (i.e., no break) to the file called ~/.forward:

"|IFS=' ' &&exec /usr/local/bin/procmail -f-||exit 75

with the correct path name for procmail, and username replaced by your e-mail address.

Resources

Acknowledgments

Jesper Pedersen lives in Odense, Denmark, where he has studied computer science at Odense University since 1990. He is a system manager at the University and also teaches computer science. In his spare time, he does Jiu-Jitsu, listens to music, drinks beer and has fun with his girlfriend. His home page can be found at http://www.imada.ou.dk/~blackie/ and he can be reached via e-mail at blackie@imada.ou.dk.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

tdg home moved

Anonymous's picture

google lists this article pretty high but where can tdg be found nowdays?

Anonymous's picture
White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState