0

When I have to test an email-sending web application on a server, how could I achive that every mails which should get delivered non-local (be sent to some remote smtp) gets stored in a local file (or mailbox) instead?

kraftb
  • 111
  • 2

1 Answers1

2

You can configure the qmail-tap feature, which is documented below:

If you want to keep a copy of incoming and outgoing mail of an account in a qmail server, you can use the qmail-tap feature.

Qmail provides the ability to make a copy of each email that flows through the system. Qmail tap feature has the following functionalities:

  • Specify which email addresses tap using a regex style control file. With the regex function, you can specify full domains or individual email addresses.
  • Specify which email address to send the tapped email address.

Qmail does not need to be restarted to change the above. Just update the taps control file.

The taps file is not included in the basic, default toaster install. You can configure it as follows:

[root@qmail ~]# touch /var/qmail/control/taps

[root@qmail ~]# vi /var/qmail/control/taps

Insert the tap information and save

Examples:

a) To tap a whole domain add a line like:

.*@domain.com:bcc@example.com

'bcc@example.com' gets a copy of all incoming and outgoing mail for the domain, 'domain.com'

b) To tap an individual email address add a line like:

user@domain.com:other@example.com

'other@domain.com' gets a copy of all incoming and outgoing mail for 'user@domain.com'

bentek
  • 2,205
  • 1
  • 14
  • 23