# Courier MTA - howto deliver and forward

## tps

Dear All

I run a Courier MTA.

A specific e-mail account on the Courier MTA should accept incomming mails AND forward/copy incomming mails to another e-mail address.

How do I do that?

If I enter the forwarding e-mail address in a '.courier' file in the users home directory, then the mail is only forwarded and not accepted by the accout.

I want to do both!

Thanks

----------

## nahpets

Under postfix, I use a '.forward' file, which I'm guessing does the same as your .courier file.  I have a setup where I forward my mail to another address as well as delivering it locally.  My .forward file looks like this:

```

nahpets, nahpets@external-mail.com

```

----------

## tps

Thanks for the reply.

I get a mail loop when I enter the name of the account in the .courier file belonging to the same account.

Ex.

Two e-mail accounts: a@a.a and b@b.b

Account a@a.a is the account on my Courier MTA

Account b@b.b is my account at work

I create a .courier file in the home directory of the a-user on the same box running the Courier MTA.

Content of .courier file is a,b@b.b

I send a mail from b@b.b to a@a.a

a@a.a receives nothing

b@b.b recieves a copy of the mail (expected) and another mail from the Courier MTA telling that a mail loop was created (not expected)

What am I doing wrong?

Thanks

----------

## nahpets

It seems that there is a difference between .forward and .courier.  Maybe you can try putting your to addresses in a .forward file instead.

http://www.courier-mta.org/?dot-courier.html

http://www.courier-mta.org/?dot-forward.html

----------

## tps

Hi Nahpets

Thanks for the links.

I read the man pages but still I don't know how to deliver and forward at the same time.

Thanks

----------

## nahpets

From the docs:

```

To read forwarding instructions from $HOME/.forward, put "|| dotforward" on the first line of $HOME/.courier*

```

You can then put your addresses in the .forward file like I suggested.  The format of the '.forward' file can be:

```

If $HOME/.forward exists, it is expected to contain a list of addresses that the message should be forwarded to. An address may be an actual E-mail address, or a name of a program or a mailbox. Each line in $HOME/.forward should contain a list of comma-separated addresses. Use "| /path/to/program" (including the double quotes) to specify a delivery to a program (the message is piped to the given program). Use "/path/to/mailbox" or "./path/to/mailbox" (again including the double quotes) to specify a delivery to a mailbox (relative to $HOME in the second case).

```

If using 'user@localhost, user@external.com' still creates a look, you can try delivering directly to the local mailbox using "./path/to/mailbox, user@external.com", or you can pipe your mail to an external program like maildrop or procmail.  I use procmail myself and it's very flexible.

----------

## tps

Dear nahpets

I am in the dark here!

Thanks for the links - J have read the links, tried several combinations of .forward, .courier.

Still no luck.

Do you know a courier mail admin that can make this work?

Thanks

----------

## nahpets

Don't know a courier admin, sorry.  Postfix seems to be the more popular MTA among Gentoo users.  Have you tried procmail yet?  It should let you do what you want using 1 or 2 simple rules.  The Gentoo wiki has a courier guide that shows how to use maildrop to deliver mail, have you looked at it?

Lastly, have you considered switching to Postfix altogether?  One of the reasons that Postfix is very popular is because installation and configuration are pretty easy.  There are several guides on the Gentoo wiki (http://gentoo-wiki.com/Postfix).

----------

## tps

Dear nahpets

I hear your point and your point might be exactly the reason I should take a look a postfix.

Up til this point I have been very happy with courier MTA.

Perhaps I should try to look for a dedicated courier MTA mail list.

Thanks for all your help.

Thanks

----------

## tps

Dear nahpets

I have this in my .courier and now it works - thanks

./.maildir/

b@b.b

Thanks

----------

