1

I want to route all incoming emails for local domains only to a single account if an account is not setup for that user.

I would also like each email to be written in it's own file in user folder.

I have a catchall user with /home/catchall/ path where I have a mail folder made for this but so far emails wither fail to deliver (thus my rule did not work) or they do deliver to /etc/mail/catchall file.

I have been trying to put something together from the Exim configuration but so far nothing seem to work.

http://exim.org/exim-html-current/doc/html/spec_html/ch20.html

1
  • 1
    OK thankfully I have found the exim -bt and thus found a way to test each atempt faster. I have figured out how to catchall now I just need to write each email to a separate file. Nov 13, 2012 at 16:40

2 Answers 2

2

Setting Exim to catch all email sent to local domains:

After:

begin routers

Add:

catchall_pub:
  driver = redirect
  domains = +local_domains
  user = catchall
  data = catchall@localhost

This will enable a catch all for all local_domains. They are set like this:

domainlist local_domains = @ : localhost : localhost.localdomain : example.com

Note: you can simply specify to catch a single domain and make multiple rules for multiple domains.


In order to configure Exim to create individual files for each email you just simply have to switch the local delivery to directory mode like this:

Find:

local_delivery:
  driver = appendfile
  file = /var/mail/$local_part
  delivery_date_add
  envelope_to_add
  return_path_add
  group = mail
  mode = 0660

Add in place of file = /var/mail/$local_part:

  directory = $home/mail
  maildir_format
  maildir_use_size_file  

Note: This will automatically create a nice mail directory in user's home folder when he receives his first email. The structure is the well known cur/, new/, tmp/ one.

1

Not so clear what do you really want saying "each email to be written in it's own file"

If you've use maildir format, all messages stored in seperate files anyway. Just add special router AFTER all existent:

unknown:
       driver          = redirect
       domains         = +local_domains
       data            = [email protected]

If you've use mailbox format and want messages for certain user be stored into his own mailbox file, use special transport:

# router
unknown:
           driver          = accept
           domains         = +local_domains
           transport       = t_unknown

# transport
t_unknown:
           driver          = appendfile
           file            = /var/mail/$domain/$local_part
           group           = mail
           user            = $local_part
           mode            = 0660
1
  • I already figured this part out. I posted a comment to my question. I now need to configure exim to write each email to an individual file. Nov 13, 2012 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .