Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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. –  tntu Nov 13 '12 at 16:40

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer

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            = unknown@my.domain.tld

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
share|improve this answer
    
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. –  tntu Nov 13 '12 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.