|Subject:||Re: [courier-users] Aliases with Courier ESMTP using ESMTPD|
|From:||Jeff Jansen (ivb_...@sil.org)|
|Date:||Apr 23, 2004 2:56:04 am|
On Friday 23 April 2004 08:20, Thoralf Rickert wrote:
Hmm, okay, but I've just one system user that accepts mails (called maildrop). I'm using virtual users with virtual domains. Mails for user@<domain1> will be accepted by courier, if the email address is in the mysql database. Users login to IMAP and POP3 using this email address, maildir and a password also saved in the database.
OK, you lost me here. Let me see if I can get up to speed with your situation. (And maybe someone who "sees" this better than I do can help you better as well.)
If you have an account "user@domain1" in your mysql db then as I understand it then when courier sees mail coming for "user@domain1" it will deliver mail to that user's account as defined in the db. This has nothing to do with delivering all mail for a domain to a local user. This is standard mail delivery. The user is "virtual" in the sense that he's not an actual system user on the box. But he has his own HOME directory, Maildir, etc. all specified in the db. This is not a "virtual" domain; this is an actual (hosted) domain on your box.
Now you want to add a new domain "domain2" and make it a true virtual domain. I.e. there aren't really any users for this domain on this box - you want to do something else with the mail. So you create the alias
because "maildrop" is an actual local account on the machine. Now all mail that comes in addressed to anyone '@domain2' will be delivered to user "maildrop". Or more precisely when mail arrives for "someuser@domain2" courier attempts to deliver it to user "maildrop-someuser". So joe@domain2 gets delivered to maildrop-joe, bob@domain2 get delivered to maildrop-bob, etc.
So in the case of joe@domain2 courier looks for a user called "maildrop-joe". If such a user exists (as a system user, in userdb, in mysql, etc.) then courier delivers the mail to that user. If that user doesn't exist, then courier strips whatever's after the dash (-) and tries to deliver to the remaining address ('maildrop' in this example), looking to see if that user has any instructions for what to do with the information that was after the dash.
If I want to deliver any mail from <domain2> to a virtual user, do I have to put the .courier-* file into the <maildir-home> directory? But what "user" I have to save in /etc/courier/aliases? maildrop? And then - how do I tell courier to accept messages for that user? I'm using the email addesses as user-account-names.
Well that totally depends on what you want to do with the mail. If you want all mail for joe@domain2 to go to joe@domain1 and so on then you could create a .courier-default account with
because $EXT will grab the part after the dash ("joe" in this case) and so forward mail to joe@domain1. (Of course a much easier way to do this is the create an alias domain in hosteddomains, but you get the idea.)
How to I tell the system to forward emails for *@<domain2> to another email address.
You create a .courier- file that tells courier what to do with the address. So .courier-joe (in maildrop's HOME directory) tells courier what to do with mail being delivered to maildrop-joe. .courier-bob tells courier what to do with mail being addressed to maildrop-bob, etc. .courier-default tells courier what to do with mail for maildrop-* for which there are no other instructions.
OK, so does that help at all or have I just made everything more confusing? ("Clear as mud" as they say. :-)