# Production mailserver setup, courier imap/smtp/pop3 v1.7

## Redeeman

THIS HOWTO HAS MOVED TO MY OWN WIKI!!!

http://wiki.kaspersandberg.com/doku.php?id=howtos:courier-mailsuite

----------

## Redeeman

is there any interrest at all? if there isnt, i will not keep adding more stuff to it

----------

## sn4ip3r

Nice howto, I think I might try it on my "home-server".

But I have some questions:

Is it possible to filter all mail through spamassassin instead of

only for those users who have .mailfilter file?

Is it possible to have a user with no home directory?

Some other guides have also included fetchmail, can it be

used here aswell?

----------

## Redeeman

 *sn4ip3r wrote:*   

> Nice howto, I think I might try it on my "home-server".
> 
> But I have some questions:
> 
> Is it possible to filter all mail through spamassassin instead of
> ...

 

you need to have a "main" directory for the users, but that doesent mean a home directory, just some directory, you specify.

i think its possible to pipe all mail through spamasassin. i will try to find out how, and explain it better.

fetchmail.. yes, i can try, but me and fetch/procmail isnt best friends, but i will do my best

----------

## riposte

Excellent how-to - thanks

I have one small problem you may be able to help with.

Incoming mail is making it to the mail queue but is not being delivered.

What settings if any should there be in /etc/courier/courierd with regard to delivery?

Do I need to enable maildrop?

----------

## GurliGebis

Does the SMTP use auth?

----------

## AkiAki007

I have an interesting problem which I can't figure out the answer to. I have set up mail using QMail, f-prot for virus checking, SpamAssassin (with spamd) and courier-imap. QMail, f-prot and courier-imap all work fine. I can't get SpamAssassin to do anything, nor can I figure out how to log what it is doing.

I've sent some test spam  and they all manage to get through. What's more annoying is that there is no X-Spam header saying that it got through SpamAssassin and what the score was.

my /etc/conf.d/spamd file is

```
SPAMD_OPTS="-a -d -c -u qmaild -x -C /etc/mail/spamassassin/local.cf"
```

and my /etc/mail/spamassassin/local.cf file is

```
required_hits 5.0

rewrite_subject 1

subject_tag *****SPAM*****

report_safe 1

report_header 1

use_bayes 1

auto_learn 1

skip_rbl_checks 0

use_razor2 1

use_dcc 1

use_pyzor 1

ok_languages all

ok_locales all
```

I also have copied all the xx_*.cf files into /etc/mail/spamassassin (i saw this in another post) from /usr/share/spamassassin

Any help would be great.

Oh, and while I'm asking, I don't suppose anyone would know about qmail-scanner. It is good, but it quarantines the virus, I'd rather have it send a notification to someone (admin). It currently only notifies the sender (which I don't want it to do) and does not notify the admin (which I do want it to do).

thanks!

and if anyone needs help with qmail, i can try. I managed to get it to relay quite well to MS Exchange, which was my initial goal.

----------

## Redeeman

i think this is a qmail settings which is wrong. but i dont know

----------

## Redeeman

i think this is a qmail settings which is wrong. but i dont know

----------

## AkiAki007

I eventually got some help in IRC in #qmail...the problem was that I didn't have spamd running when I emerged qmail-scanner. When compiling qmail-scanner, all external scanners to be used by qmail must be running (f-prot, clamav, spamd/spamassassin, sophos, whatever), otherwise the script that is generated won't be correct.

----------

## pagerc@ufl.edu

If you really want to propogate stuff, stick it in /etc/skel/

when new users are created, all the files in /etc/skel are copied to the new home directory.  This user's home dir may exist anywhere.

Don't do anything stupid with links though, like have root's config files link to /etc/skel, this would cause headaches for some people, so be forewarned.

----------

## Redeeman

 *pagerc@ufl.edu wrote:*   

> If you really want to propogate stuff, stick it in /etc/skel/
> 
> when new users are created, all the files in /etc/skel are copied to the new home directory.  This user's home dir may exist anywhere.
> 
> Don't do anything stupid with links though, like have root's config files link to /etc/skel, this would cause headaches for some people, so be forewarned.

 

if you are referring to the thing about making global mailfilters, this isnt a way of doing it, as this guide could aswell use virtual users, that doesent have a global system user, but it could also be a system user, and then it would work

----------

## Roderik

I really liked the guide but if you aren't too busy you might have time to ad an addendum to the guide for a folowing situation.

I'm currently working in a small buisness and we run MS small buisness server 2003 with the pop3 connector. So the enterprise mail system and a pop3 downloader that places the mails on a pop3 account in one users mailbox. This way we keep the stability of our web/mail host + the ability to work with the same mails at the same time. (IMAP etc)

I'm looking for a linux gentoo based system like the one you described above together with a pop3 connector (fetchmail?) to replace this system with an opensource one. The pop3 connector part is nowhere to be found in any of the linux mail server guides i could find. Maybe you could help  :Smile: 

----------

## Redeeman

yes, i am currently working on this. so it should likely come soon.

i need a pop3 connecter for my own setup too.

i havent decided wheter to use getmail for fetchmail.

but you will hear from me soon

----------

## Roderik

GREAT!  :Smile: 

----------

## Redeeman

i can see that i havent got any further on this yet, so it will take some time, i will update the guide right now, allthough only a very minor upgrade, its stille there..

----------

## malloc

Redeeman asked for a volunteer to write a little faq on getting fetchmail to work, so here i am  :Smile: 

So let's get down to business.

Once you've emerged fetchmail, first thing to do is to go over to /etc/conf.d/fetchmail and choose your poll time (remember this is in seconds). Don't choose a value too low if you're polling from external servers because they might get p*ssed at you and terminate your account and ban your ip.

Here's my config for example, it polls every 30 minutes you could go as low as 10 minutes, lower than that and make sure you're a close friend to the other mail server admin  :Smile: 

```
# Polling frequency in seconds

# (fetchmail will daemonize and check for new mail at this interval)

polling_period="1800"
```

Choosing time in here will force fetchmail to run in daemon mode, this means that you must use a central fetchmailrc file for all your users, wich, depending on your config might be acceptable or not.

If you want to give the capacity to have each individual client run it's own instance of fetchmail (NOT in daemon mode) you need to enforce a ~/.fetchmailrc file to each client tailored to their individual need.

Let's look at an example of a fetchmailrc file

```

set postmaster "malloc"

poll pop3.mymail1.com with proto POP3 user "malloc" there with password "lalala" is malloc here options keep warnings 3600

poll mymail2.com with proto IMAP user "malloc@mymail2.com" there with password "ugauga" is malloc here options fetchall warnings 3600

poll mymail3.com with proto AUTO user "malloc@mymail3" there with password "xuxuxu" is malloc here options warnings 3600

```

Ok now let's see each command in detail...

```
set postmaster "malloc"
```

This one tells the MTA wich user is running the queue. If you want an individual config you need to put the user's name on each config file. If you're going global you should put the username of the MTA (for example user postfix if you're running it). Of course that if you go global you need to put every single user's external account here.

```
poll pop3.mymail1.com with proto POP3 user "malloc" there with password "lalala" is malloc here options keep warnings 3600
```

Ok this line is preety self-explanatory. 

You say wich server you want to poll, wich protocol the external server runs  (POP3, IMAP or AUTO) and the remote server username:password your user has. Then you just need to say who is your user, the options part has 2 parts the "warnings 3600" is just for more verbose messages the KEEP and FETCHALL options are to (in order) keep all the mail in the external server and to fetch all messages (even messages previously downloaded ones.) 

YOU SHOULD NOT RUN THESE 2 OPTIONS TOGETHER IF YOU'RE RUNNING FETCHMAIL IN DAEMON MODE!!!!

Ok we're almost done.

Now try to run fetchmail in debug mode just to see if everything is ok 

Now if you chose the global config just add fetchmail to the default runlevel and it's done. 

If you've gone local, you can do one of 2 things.

Either add a global alias so that each user fetches his mail when he wants or put an entry on each user's crontab so that fetchmail runs at a given interval (This is not the same as running fetchmail in daemon mode).

Well i hope this helps.

----------

## Roderik

great stuff, but i'm not sure about something

i've set it up like the guide in post 1 describes, with users "only" in courier in the mySQL DB. 

```

poll pop3.mymail1.com with proto POP3 user "malloc" there with password "lalala" is malloc here options keep warnings 3600 

```

as far as i can gather tis wil deposit the mail from the pop server into the maildir of the "linux user" malloc. On my test system i've got a shell user roderik and in /srv/mailroot/roderik a mail homedir with a .maildir. The two have nothing in common save the login name.

How can i send the mail from the pop mail server to an .maildir in some other location.

----------

## malloc

Fetchmail relies heavily on procmail or any other internal delivery system, so it will simply parse the mail to it and then where it goes is the delivery system business.

----------

## Redeeman

 *Roderik wrote:*   

> great stuff, but i'm not sure about something
> 
> i've set it up like the guide in post 1 describes, with users "only" in courier in the mySQL DB. 
> 
> .

 

i believe that if you want to use pop3 connectors, you will need to have real unix users, in order to have fetchmail run as them, let me know if this helps

----------

## gmichels

 *Redeeman wrote:*   

> MX records 
> 
>  if you have some kind of ugly and deeply annoying isp, like mine (TDC). they block for incoming traffic on port 25 
> 
>  that will break support for incoming mail. but there is a workaround. but luckily the ISP is then providing a MX mailserver to fix this 
> ...

 

Would you mind explaining this a little further? My isp blocks incoming connections on port 25, so I am looking for a way to receive mail, but I couldn't understand your solution.

cheers

----------

## GurliGebis

It is really simple, some ISP's block access to port 25, so for you to be able to recieve emails you have to set your ISP's MX record so it works.

That means that people trying to send you mails will send the email to their mailserver, it will then try to connect to your mailserver which it cannot do, since your ISP is blocking it.

It then tries the next mailserver in the MX list, which in this case is backup-mx.inet.tele.dk .

Not sure if I made it really clear, but you might try contacting your ISP and ask them what you should do.

----------

## gmichels

I must be missing something really easy, as I can't understand how this setup will get the mail to be delivered to my mail server.

My dyndns domain is michels.dyndns.org, which has an MX record pointing to michels.dyndns.org, where my mailserver is (25 incoming blocked).

Are you telling me if I create a backup MX record pointing to my ISP's mailserver, I can receive my mail? Will the ISP's mailserver relay the mail to my mailserver?

----------

## GurliGebis

yep

----------

## gmichels

Ok, so let's hope my ISP really does that  :Very Happy: 

Just to be sure, take a look at the setup (virtua.com.br is my ISP):

```
# dig mx virtua.com.br

; <<>> DiG 9.2.3 <<>> mx virtua.com.br

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59805

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 3, ADDITIONAL: 5

;; QUESTION SECTION:

;virtua.com.br.                 IN      MX

;; ANSWER SECTION:

virtua.com.br.          3600    IN      MX      10 mail3.globocabo.com.br.

virtua.com.br.          3600    IN      MX      20 mail2.globocabo.com.br.

virtua.com.br.          3600    IN      MX      10 mail1.globocabo.com.br.

;; AUTHORITY SECTION:

virtua.com.br.          3600    IN      NS      ns.embratel.net.br.

virtua.com.br.          3600    IN      NS      dns1.virtua.com.br.

virtua.com.br.          3600    IN      NS      dns2.virtua.com.br.

;; ADDITIONAL SECTION:

mail1.globocabo.com.br. 2402    IN      A       200.231.181.68

mail3.globocabo.com.br. 8658    IN      A       200.231.181.114

mail2.globocabo.com.br. 328     IN      A       200.231.181.97

dns1.virtua.com.br.     3600    IN      A       200.212.223.100

dns2.virtua.com.br.     3600    IN      A       200.212.223.102

;; Query time: 26 msec

;; SERVER: 192.168.0.254#53(192.168.0.254)

;; WHEN: Mon May  3 10:26:44 2004

;; MSG SIZE  rcvd: 255
```

```
# dig mx michels.dyndns.org

; <<>> DiG 9.2.3 <<>> mx michels.dyndns.org

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11439

;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 7

;; QUESTION SECTION:

;michels.dyndns.org.            IN      MX

;; ANSWER SECTION:

michels.dyndns.org.     43200   IN      MX      10 mail1.globocabo.com.br.

michels.dyndns.org.     43200   IN      MX      5 michels.dyndns.org.

;; AUTHORITY SECTION:

dyndns.org.             86400   IN      NS      ns3.dyndns.org.

dyndns.org.             86400   IN      NS      ns4.dyndns.org.

dyndns.org.             86400   IN      NS      ns5.dyndns.org.

dyndns.org.             86400   IN      NS      ns1.dyndns.org.

dyndns.org.             86400   IN      NS      ns2.dyndns.org.

;; ADDITIONAL SECTION:

michels.dyndns.org.     60      IN      A       200.185.142.110

mail1.globocabo.com.br. 10501   IN      A       200.231.181.68

ns1.dyndns.org.         86400   IN      A       63.208.196.90

ns2.dyndns.org.         85233   IN      A       209.69.32.137

ns3.dyndns.org.         85233   IN      A       63.209.15.210

ns4.dyndns.org.         85233   IN      A       213.155.150.205

ns5.dyndns.org.         85233   IN      A       63.208.196.91

;; Query time: 211 msec

;; SERVER: 192.168.0.254#53(192.168.0.254)

;; WHEN: Mon May  3 10:35:18 2004

;; MSG SIZE  rcvd: 292
```

Is that ok?

----------

## gmichels

It was too good to be true:

```
200.231.181.68 does not like recipient.

Remote host said: 550 Relaying is prohibited

Giving up on 200.231.181.68.
```

So I guess it's a dead end. 

Thanks for your help.

----------

## nepenthe

I'm afraid i'm a bit lost when it comes to adding users... how do I through phpmyadmin? Or normally... either way rather anyway =) Thank you... excellent guide by the way.

----------

## Redeeman

you just add users using any mysql client, however, phpmyadmin is probably the easiest.

you just open the courier database, and insert a user  :Smile: 

----------

## nepenthe

okay so go into the courier database and add a new table? with the field id, clear, name and the rest?

Okay got it straightened out =)

----------

## Hibbelharry

Hey guys,

i tried to follow your guide carefully, but i have a problem regarding local mail delivery. i'm able to send mail to external servers, but sending mail to local users fails. there are messages in the log about destination users are not known. I want to use accounts which are not really existing on the system and added the virtual users with phpmyadmin. i created maildirs for them and they are able to login to webmail and with imap clients. Copies of sent messages also appear in the sent folder. what did i miss ? any ideas ?

Greetz 

Hibbelharry

----------

## Redeeman

you should be able do send to them as any other email, using their full email adress

----------

## Hibbelharry

hey redeeman,

that's exactly what i try to do, when i access the mailserver using imap i can't even send the email, i get a user not known message instantly. do i have to add the virtual users anywhere else except in the sql passwd table ? i have set them all to to uid 8 /gid 12 and have created a folder called exactly the same as the email alias without domain in /home/mail. thats also what i specified as the homefolder in the sql table. is the content of any configuration file helpful ? any other hints ?

The smtp server also has some seconds delay before sending the mails, but thats a minor problem for now, let's get the delivery thing to work.

Any help is really appreciated !

greetz

Hibbelharry

----------

## Redeeman

try take a look at some file called esmtpacceptmailfor or something like it

----------

## riposte

Hi Guys

I recently upgraded courier and mysql and now the smtp server rejects all mail as "User unknown". I probably fubar'd one of the config files but I cant find what is wrong. I can authenticate (thru mysql) using imap or pop3 and I can telnet to the smtp server but that is all.

I have re-followed the set up steps in this guide but without success.

Any pointers as to how I can track this down?

Thanks

----------

## Redeeman

try look at the logfile

----------

## CarlUman

 *Redeeman wrote:*   

> is there any interrest at all? if there isnt, i will not keep adding more stuff to it

 

I found it interesting and will remember this for future reference.

Thanks

----------

## riposte

Thanks for the quick response Redeeman but can you be a little more specific?  I have looked at mail.log, mail.err and mysql.log but they only confirm what I already know.

Excellent guide BTW - easy to understand and well written.

I also set up Spam Assassin and Fetchmail acording to your instructions and it worked really well. If you are going to add more stuff to it (please) how about using Amavisd-new to handle both Spam Assassin and a virus scanner such as Clamav.

----------

## Hibbelharry

hey guys, 

i had the same problem and after investigating and knocking my head on my desk for ....minutes i found that i made a mistake in authmysql config. reread your configuration there carefully and take a look for # at the beginnings of lines commenting your settings out, that was my mistake and i had exactly the same problem. Next problem i have to solve is to share folders for virtual users. ive set up rights with maildiracl but they are not visible for the other users.... any ideas ?

greetz

Hibbelharry

----------

## riposte

Hi Hibbelharry

Did you mean authmysqlrc?

----------

## Redeeman

yes he do

----------

## riposte

Hmmm.... if anything was wrong in that file then I wouldnt be able to log in to Imap or connect via the Pop3 server.

My problem appears to be confined just to Smtp.

----------

## Redeeman

then try look if the esmtpd file is having some of the needed stuff commented out

----------

## riposte

Thanks guys - problem solved.

The bit about authenticated smtp relaying in esmtpd was commented out.

I better clean my glasses - I should have spotted that.

----------

## BlinkEye

Redeeman, this is a great guide indeed. i haven't tried it yet but i will. i wanted to set up virtual users from the beginning but i didn't understand the mysql section (i.e. how to add users   :Crying or Very sad: ) from the virtual mailhosting guide http://www.gentoo.org/doc/en/virt-mail-howto.xml . 

thanks a lot for your effort!

----------

## Parasietje

Great howto, one small problem though.

My home router serves the internal domain 'parasite.org'. Its own hostname is 'agatha.parasite.org'.

I should use my DynDNS hostname for the mailserver though... Otherwise, incoming messages will never make it to my server. Yet won't this conflict? I won't add an entry with my DynDNS hostname in /etc/hosts, as this will conflict with my local DNS server. How should I set this up correctly?

----------

## GurliGebis

Small addition.

To make aliases:

First, do : 

```
touch /etc/courier/aliases/domain (etc. gentoo.org).
```

Then, edit it, and add emails in this format:

```
alias@domain.tld : to@domain.tld
```

This would make emails to alias@domain.tld be going to this email: to@domain.tld .

after doing this you must do: makealiases .

----------

## Zacay

I just followed the guide but I have problems receiving emails from outside the network..

This is the error from the mail delivery report:

 *Quote:*   

> <zico@zacay.se>: host mx1.zacay.se[212.112.180.215] said: 513 Relaying denied. (in reply to RCPT TO command)

 

I don't know where to search for error? Anyone care to help me?

----------

## GurliGebis

It means the server does not accept mail for that domain, check /etc/courier/hosteddomains and that there is a file in /etc/courier/esmtpacceptmailfor.dir called the domain name, and contains the domain name (and nothing else).

When both of those are okay, run:

```
makehosteddomains

makeacceptmailfor
```

Then restart courier.

----------

## Zacay

Thanx.. I didn't have any domain name file in  esmtpacceptmailfor.dir

I did this

```

izabelle esmtpacceptmailfor.dir # ln -s /etc/courier/hosteddomains hosteddomains

izabelle esmtpacceptmailfor.dir # makeacceptmailfor 

izabelle esmtpacceptmailfor.dir # makehosteddomains 

izabelle esmtpacceptmailfor.dir # /etc/init.d/courier restart

```

----------

## GurliGebis

you do not have to link it.

You have to edit  the file and add the domain to it.

----------

## Zacay

Why not link it?

It seems like a better solution, I never have to edit that file.. Only hosteddomains.. 

And I made scripts for adding domain names to my server, bind settings, apache settings, user settings and now courier settings.. All it does is add the domain name to hsoteddomains  :Very Happy: 

----------

## GurliGebis

Ahh, I see your point  :Smile: 

----------

## slougi

I am unable to connect to courier from outside my local network... I get a 550 error. I am also unable to send mail. Locally everything works.

I opened port 25 in my firewall.  

Anything else that should be done?

----------

## GurliGebis

 *slougi wrote:*   

> I am unable to connect to courier from outside my local network... I get a 550 error. I am also unable to send mail. Locally everything works.
> 
> I opened port 25 in my firewall.  
> 
> Anything else that should be done?

 

What does the error say?

----------

## slougi

 *GurliGebis wrote:*   

>  *slougi wrote:*   I am unable to connect to courier from outside my local network... I get a 550 error. I am also unable to send mail. Locally everything works.
> 
> I opened port 25 in my firewall.  
> 
> Anything else that should be done? 
> ...

 

Whoops sorry. I get a 550 error when trying to send mail to a user from outside;  e.g. from google mail

```

PERM_FAILURE: SMTP Error (state 10): 550 5.7.1 Invalid recipient: '<user>@<foo>.com'
```

(I edited out the username and domain.)

When trying to connect to the imap server from outside the local network using Outlook Express (yeah yeah I know it sucks, just for testing)  it just says the connection to the server failed.

Sending mail locally to local users works, and checking mail inside the local network also works. So I think I need to open some more ports or something similar.

----------

## riposte

I think you need port 143 for imap and 110 for pop3 connections.

----------

## shadowteller

Would like to thank Redeeman for the assist on this one...it was basically a typo which I found and a bad file which he found.

Very easy to understand howto 

Problem arises though... 

I can send outgoing mail through external software like outlook and oe (my potential users will use these most likely) but when I try sending from mutt I don't receive mail internal or externally. 

I also can't get webadmin to work at all...I get the login screen and when I login (I did use the cooly little password file and set appropriate permissions for it) I get denied. Now if I set the user from mail to apache on the password file everything works, but any changes made in webadmin crap the bed. so UMMMMM what did I hose.... 

~prestNLast edited by shadowteller on Sat May 07, 2005 5:56 am; edited 1 time in total

----------

## smutt

Does anyone know how to restrict imaptcpd to only accept connections from localhost?  I'm running both courier imapd and imapd-ssl and I only want to use imapd for Squirrelmail which is running on the same box.  I want to force all remote IMAP users to use imapd-ssl.  Any help would be appreciated.  Thanks in advance.

--Smutt

----------

## shadowteller

 *smutt wrote:*   

> Does anyone know how to restrict imaptcpd to only accept connections from localhost?  I'm running both courier imapd and imapd-ssl and I only want to use imapd for Squirrelmail which is running on the same box.  I want to force all remote IMAP users to use imapd-ssl.  Any help would be appreciated.  Thanks in advance.
> 
> --Smutt

 

You can block the incoming ports that you don't want to use.

I used vhosts and set up a mail.mydomain.com entry with a virtualhost *:993 for that subdomain.  Then you set squirrel mail up to only ;isten on that domain and said port...you can disable all other ports in the .conf for SM.

Hope that helps a bit.

----------

## busa

Hallo @ all

fist of all: thanks a lot for this howto. It's just perfect!

But, im still having a question:

SpamAssassin and Antivir ar working. But if a mail is recognised as Spam, my virusscanners are not checking it anymore. It's delivered without a virus-check.

Does anybody know this problem?

Thanks for your tips

busa

----------

## BlinkEye

i guess the problem is not amavisd-new but fetchmail. check your config (or crontab entries) for fetchmail. if you use the following

```
*/10 * * * * /usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d \%T"
```

your fetched mail will not be handed to postfix as per default but to procmail and hence bypass amavisd-new.

use

```
*/10 * * * * /usr/bin/fetchmail -a -s"
```

instead.

----------

## cprior

I finally managed to get courier running, and want to share issues as per march 2005:

In /var/lib/courier you should see sth like:

```
ls /var/lib/courier

allfilters  calendar         faxtmp   msgq  sqwebmail.sock  track

authdaemon  couriersslcache  filters  msgs  tmp             webmail-logincache
```

If you are missing msgs or other folders, see bug https://bugs.gentoo.org/show_bug.cgi?id=82286 or emerge =mail-mta/courier-0.49.0

A test if authdaemon is working and local mail set up, use on our Gentoo system sth. like

```
"To: root" | /usr/sbin/sendmail
```

A nice resource for courier is http://perlstalker.amigo.net/courier/ , the author runs a cluster of courier servers with Gentoo as load balancer. The FAQ adress 2 Gentoo specific problems (but none should apply to you if you followed redeemans howto).

Autlib's config  moved to /etc/courier/authlib, if you create files in /etc/courier you will see no changes  :Razz: 

This also effects the webadmin module which will not work for "Password authentication modules".

----------

## Nimo

How to get this guide working with bogofilter and procmail?

----------

## shadowteller

 *cprior wrote:*   

> I finally managed to get courier running, and want to share issues as per march 2005:
> 
> In /var/lib/courier you should see sth like:
> 
> ```
> ...

 

I just can't seem to figure out why I can't get courier to work.  I had working once before and had to blow the system away cause a partion issue.  And I decided to recompile the stage 1 with new cpus and memory.  But now things don't work. 

Buhaha can't connect to anything...can't get squirrelmail or sqwebmail to work...hmmmm argghhhhh

~prestN

----------

## marky9074

I am progressing through the production mail server howto...but... 

Configuring courier 

edit /etc/courier/authmysqlrc (This file doesnt exist!) 

edit /etc/courier/authdaemonrc (This files doesnt exist!) 

edit /etc/courier/aliases/system 

edit /etc/courier/hosteddomains (This files doesnt exist!) 

edit /etc/courier/smtpaccess/default 

Now I can create this files and wing it. But say the authdaemnonrc refers to a part of the file, so assuming that it is actually there in the first place. 

Have you got these files? 

Mark

----------

## biatch0

In the latest portage tree, authdaemonrc is in /etc/courier/authlib/authdaemonrc

----------

## marky9074

...updating portage....there wasnt an authlib directory for 0.48.1 which is the latest usable for Sparc...

----------

## marky9074

I've emerged portage, unmerged and emerged courier and still no files and no authlib directory.....

----------

## marky9074

I had to emerge net-libs/courier-authlib again (even though it said it was already installed) and it all appeared!

----------

## biatch0

If that happened, you probably emerged courier-imap before vpopmail... it needs to be vpopmail, courier-imap otherwise authdaemonrc (and the other missing friends) aren't created.

----------

## marky9074

I had some more problems, my router's DNS was causing errors with outgoing mail, it was saying DNS error - domain does not exist.  Once this was disabled it all worked OK for outgoing mail...

MarkLast edited by marky9074 on Mon Apr 25, 2005 2:04 am; edited 2 times in total

----------

## woZa

Thanks for this guide... Got Courier up and running after a bit of messing with the database side of things. I suggest to all who are having problems logging on (as I was) to delete your "courier" database and go through the steps again. Very carefully!

3rd time lucky for me...

----------

## marky9074

 *Zacay wrote:*   

> Thanx.. I didn't have any domain name file in  esmtpacceptmailfor.dir
> 
> I did this
> 
> ```
> ...

 

I think this should be added to the main how to.....

I added another domain, followed the instructions, but got a relaying error, as soon I did the above it worked fine....

Mark

----------

## marky9074

To get the webmail working using this guide, you need to point to the following (replacing localhost with your servername):

http://localhost/courier/webmail

Or copy the webmail to the cgi-bin directory and:

http://localhost/cgi-bin/webmail

I could only get webadmin working using unsecureok

----------

## woZa

I have run into a few issues with this setup... Mainly that sending mail to certain addresses gets bounced as spam. Seems to be only SORBS servers that bounce the mail because I have a dynamic IP.

So is there a way to get courier to check the destination address to see if it is local or not. If it's local then send as normal, if not local the send using my isp's smtp server? If the mail client just uses the isp's smtp server then local mail will still get delivered via the net and back rather than never leaving the local network...

----------

## eremini

Hello,

i've got a weird problem I don't have authmysqlrc and authdaemonrc files in /etc/courier at all

 Edit: Files were found it /etc/courier/authlib May be this guide should be edited?

Now I have another problem there is no line starting with"version" in authdaemonrc 

Any idea?

----------

## eremini

Also i tryed sending an email from my other adress to the new adress it comes back like this

Final-Recipient: RFC822; <admin@btwarehouse.org>

Action: failed

Status: 5.2.0

Remote-MTA: dns; mail.btwarehouse.org (194.226.215.186)

Diagnostic-Code: smtp; 513 Relaying denied.

----------

## JeffBlair

OK, I think I have this straight in my head, but let me know if I need to be smacked around.  :Wink: 

I have my server installing Gentoo at home right now. Do you know how long it takes to do a 1/3 install on a P3 550??  :Shocked:   Anyway, I have a domain setup, not a dydns one. I know I can go in there to set up the MX records. I don't know if my ISP blocks port 25 yet. But, I still will have my ISP's e-mail account. So here is what I was thinking I would have to do:

1. Run thru this great How-To  (thanks a lot)

2. setup my .maildir  in  /home/mail/jeff

3. Setup FetchMail like this:

```

set postmaster "jeff"

poll mail.grandecom.net with proto POP3 auth password user "myaccount" there with password "yadayada" is jeff here options warnings 3600

```

Will this still send all of my mail from my mail ISP to my main account?

Also, I will have a home dir for myself at /home/jeff. I will be the only real user on the system. Everyone else that I setup will not have a real account on here. So do I just set them up in  /home/mail/  ?

```

i.e.

/home/mail/joe

```

Also, I would like to be able to sort it as it comes in. I know in the home mail server how-to they use procmail. How would we be able to do that here? 

Could you use the Maildrop/SpamAssasin HOWTO to filter messages?

Also, has someone setup Bogofilter/Anti-virus as well? It would be a nice add on to this.

OK, I think that is enough for now. Again, thanks for the howto.

----------

## DerChris

Hi!

First of all I would like to say Thanks fpr the great howto.

But I have little problems sending mail.  :Crying or Very sad: 

Maybe someone reading this thread can help!?

Tkx in advance.

 Chris

----------

## Cyberwizzard

At the risk of getting yelled at for kicking the topic:

Can somebody help me add filtering for this virtual mail system? I started a thread about it:

https://forums.gentoo.org/viewtopic-p-2931885.html#2931885

----------

## Lepaca Kliffoth

redeeman:

 *Quote:*   

> Since this is part of my Virtual Hosting series, you should already have the System database and user in mysql

 

There's nothing like that anywhere in your wiki.

edit: I created the "system" database and I think I did everything right. How do I test the setup?

----------

## Lepaca Kliffoth

Forget it, it works. I was a little confused but somehow got everything to work ^^ Thanks Redeeman, that was quick and it worked perfectly.

----------

## marky9074

There are a couple of new things now...

Starting courier croaks as it complains that famd is not there.......

I removed gamin (which says its the Library providing the FAM File Alteration Monitor API) and emerged famd and all was ok....

Mark

----------

## marky9074

And if you are using phpmyadmin use the USE="session" flag when you build php......on that note if you are going to use phpBB also use the "pcre" flag....

Mark

----------

## marky9074

Also the instructions for creating the mail directories now contradict each other...

It says to create the directory:

maildirmake Mail/.maildir

But later on in the defaults for the mysql tables it shows the default directly under the home directory i.e. without a 'Mail' directory......this one had me going for half an hour....

----------

## marky9074

And as a finale, if you are trying to get the webmail working......

cp /usr/lib/courier/courier/webmail/webmail /var/www/localhost/cgi-bin 

(dont sym link it as it will not run without changing permissions etc)

touch /etc/courier/webadmin/unsecureok (sometimes you have to do this sometimes you dont, even though it says if you are not running ssl you need to do this)

http://localhost/cgi-bin/webmail (substitute localhost for your server etc)

If there are no images there cp  /usr/share/courier/sqwebmail/images/ /var/www/localhost/htdocs (once I had to do this, and once I didnt!?)

Make sure that the .maildir is owned by mail:mail..............chown -R mail:mail (8:12)......otherwise you will get an error:

Internal error (module sqconfig.c, line 77)

Enjoy.....Mark

----------

## marky9074

 *marky9074 wrote:*   

>  *Zacay wrote:*   Thanx.. I didn't have any domain name file in  esmtpacceptmailfor.dir
> 
> I did this
> 
> ```
> ...

 

This did not work for me on this installation.  I had to put a seperate file for the domain name under this directory e.g. file called mail.com, then in that file 'mail.com'

----------

## PaulCompton

Hi, great howto(s) - thanks!!!

However, I am having a problem with the esmtp when it comes to receiving emails from outside. The messages are continually rejected with code 535 Authorisation Required. Yes, the domain is listed in hosteddomains and in its own file in esmtpacceptmailfor.dir and I have run makehosteddomains and makeacceptmailfor and restarted. About 50 times. I would be very grateful for help.

Meanwhile, I am working on some extra tables and fields and some php to create a nice management system for this with multiple domains, aliases, etc. Once I've finished - expected in July/August - I'll make it available here.

----------

## PaulCompton

A little further info:

showconfig is not listing any of the domains from esmtpacceptmailfor.dir, only the domain listed in "me" (which is mx.mydomain.com so to speak, whilst I am actually wanting to accept email for mydomain.com)

----------

## Redeeman

can you post the log?

try put your domain into /etc/courier/me file

allthough showconfig should list atleast one domain from esmtpacceptmailfor.dir/* 

btw, i would not have seen this if you hadnt privmsg'ed me  :Razz: 

i set watch on now though

----------

## PaulCompton

which particular log do you want?

I tried also with my domain in me, showconfig then listed this domain as the one for which it would accept mail, but I still got the same error message when I sent email to the server.

Shall I PM you all my conf files? We can then put the solution here...

I used both howtos, the one on the forums and the one on your wiki, and compared. Not much difference really, as you say.

I have tried with both the stable (0.53) and unstable (0.55) versions of courier, the error remains the same.

----------

## PaulCompton

 *Redeeman wrote:*   

> can you post the log?

 

Ah, now this may have some bearing. I didn't see it before, as I was looking in mail.warn and mail.err, not mail.log / mail.info

This from mail.log:

```
Jun  7 11:47:35 lay courieresmtpd: started,ip=[80.237.145.198]

Jun  7 11:47:36 lay courieresmtpd: error,relay=80.237.145.198,msg="535 Authentication required.",cmd: MAIL FROM:<pjc@ignitionmatrix.com>

Jun  7 11:47:44 lay courieresmtpd: error,relay=80.237.145.198,msg="writev: Broken pipe",cmd: QUIT

```

A broken pipe. Hmmm. But this still doesn't explain showconfig not listing the domains from hosteddomains - or does it?

I smoked my pipe last night and it wasn't broken.  :Confused: 

----------

## Redeeman

i dont know why it says broken pipe, or why it doesent show up in showconfig, allthough showconfig doesent show all my stuff either.

one thing i can think of, is, is there somehow permission problems at the configuration files?

try also add it to esmtpacceptrelay.dir

also try add your domain to defaultdomain file.

----------

