# Inbound Mail Swallowed

## jfb3

I've (tried to) set up Postfix, courier-pop3 on my server.  I can send outbound through it.  Inbound mail doesn't bounce back to the sender but I can't seem to find it either.  I can authenticate (I use kmail on my workstation) but no mail.  When I poke around and look in some likely directories on the server I can't seem to find any messages.  

Does anyone have any ideas?

----------

## jfb3

Here are (I think all of) the relevant portions of configuration files:

{domain} and {machine} published in case I've done something horribly insecure...

========================================

/etc/postfix/main.cf

========================================

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/lib/postfix

mail_owner = postfix

myhostname = {machine}.{domain}.com 

mydomain = {domain}.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, $mydomain,

	mail.$mydomain, www.$mydomain

unknown_local_recipient_reject_code = 450

mynetworks_style = subnet

alias_maps = hash:/etc/mail/aliases

alias_database = hash:/etc/mail/aliases

home_mailbox = Maildir/

local_destination_concurrency_limit = 2

default_destination_concurrency_limit = 10

debug_peer_level = 2

debugger_command =

	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

	 xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

manpage_directory = /usr/share/man

sample_directory = /etc/postfix/sample

readme_directory = /usr/share/doc/postfix-2.0.9

========================================

/etc/courier-imap/authdaemond.conf

========================================

AUTHDAEMOND="authdaemond.plain"

========================================

/etc/courier-imap/pop3d

========================================

PIDFILE=/var/run/pop3d.pid

MAXDAEMONS=4

MAXPERIP=4

AUTHMODULES="authdaemon"

AUTHMODULES_ORIG="authdaemon"

DEBUG_LOGIN=0

POP3AUTH=""

POP3AUTH_ORIG="LOGIN CRAM-MD5 CRAM-SHA1"

POP3AUTH_TLS=""

POP3AUTH_TLS_ORIG="LOGIN PLAIN"

PORT=110

ADDRESS=0

TCPDOPTS="-nodnslookup -noidentlookup"

POP3DSTART=YES

#Hardwire a value for ${MAILDIR}

MAILDIR=Maildir/

----------

## kashani

Let's start with some basic testing.

1. Is the server up and running? A simple ps -ef should tell us that.

2. What IP address is it connected to? netstat -ptln should show 0 0.0.0.0:25 and the postfix pid

3. Does it deliver mail when you connect directly to it?

```

telnet localhost 25

... connecting to localhost

mail from: some@addess.com

ok.

rcpt to: address@thismailmachine.com

ok.

data

.

message sent.

```

The above cuts out any DNS problems, relay problems, etc. The okays are responses from the server. You'll need to type everything else esp the last . for the mail to be sent. If the mail shows up in the user's maildir great. If not, your logs are going to tell you why. You might even want to be tailing your logs in another window while doing this. 

Let's not worry about Courier right now either. All incoming mail should be going to /home/user/.maildir/new/ (or whatever path you specified) so look there first via the command line.

4. Assuming the above worked, do the same from a machine off your local network. If you didn't get a port 25 connection I'd look at the firewall IP, addresses, etc. If you did, attempt to send the mail and watch the logs.

5. If 4 worked time to look at DNS. what is the output of

```

dig yourdomain.com MX

```

you might need to emege bind-tools before the above works. Does the ouput list the machine that should be recieving mail?

Well that should get you started on tracking this down of the Postfix side. Assuming all the tests come back okay, esp if mail in making it to the user's home dir it might be Courier not being able to find the mail due to a misconfigured path.

kashani

----------

## jfb3

1. Yep

2.  tcp  0   0 0.0.0.0:25      0.0.0.0:*         LISTEN      1332/master

3.-4. When I telnet (using ktelnet) from the server (or any other machine from beind my firewall) nothing ever says "ok".

ktelnet localhost 25

Trying 127.0.0.1...

Connected to localhost (127.0.0.1).

Escape character is '^]'.

mail from: me@ispdmain.com

...no response...after a minute I killed the connection...

[On a good note ports 110 and 143 seem to answer correctly.]

There where no messages in the Maildir/new directory that's what worried me the most.

5. The response to dig appears to give back good info (I guess): 

; <<>> DiG 9.2.2 <<>> {domain}.com MX

;; global options:  printcmd

;; Got answer:

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

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

;; QUESTION SECTION:

;rocketdolphin.com.             IN      MX

;; ANSWER SECTION:

{domain}.com.      2620    IN      MX      10 {machine}.{domain}.com.

;; AUTHORITY SECTION:

{domain}.com.      2620    IN      NS      dns15.register.com.

{domain}.com.      2620    IN      NS      dns16.register.com.

;; ADDITIONAL SECTION:

{machine}.{domain}.com. 2620 IN      A       {correct ip address}

dns15.register.com.     167663  IN      A       216.21.234.78

dns16.register.com.     139955  IN      A       216.21.226.78

;; Query time: 39 msec

;; SERVER: 192.168.2.1#53(192.168.2.1)

;; WHEN: Thu Jul 10 00:03:16 2003

;; MSG SIZE  rcvd: 156

----------

## kashani

That's really odd. I'm thinking that something might be wrong with Postfix itself. At this point remerging it might be the best idea. Do the logs say anything interesting? Actually looking at the logs while you restart Postfix might be a good idea as well.  Here's one from my server now that I've got some time to do this properly.

```

kashani@azul kashani $ telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 azul.badapple.net ESMTP Postfix

mail from: tito@badapple.net

250 Ok

rcpt to: kashani@badapple.net

250 Ok

data

354 End data with <CR><LF>.<CR><LF>

Subject: Testing 1.. 2... 3...

.

250 Ok: queued as 8CCB13A28AD

quit

221 Bye

Connection closed by foreign host.
```

and the logs from syslog-ng look like

```

Jul  9 22:29:07 src@azul postfix/smtpd[1199]: connect from localhost[127.0.0.1]

Jul  9 22:29:17 src@azul postfix/smtpd[1199]: 8CCB13A28AD: client=localhost[127.0.0.1]

Jul  9 22:29:56 src@azul postfix/cleanup[1201]: 8CCB13A28AD: message-id=<20030710052917.8CCB13A28AD@azul.badapple.net>

Jul  9 22:29:56 src@azul postfix/qmgr[19672]: 8CCB13A28AD: from=<tito@badapple.net>, size=372, nrcpt=1 (queue active)

Jul  9 22:29:57 src@azul postfix/local[1221]: 8CCB13A28AD: to=<kashani@elsanto.badapple.net>, orig_to=<kashani@badapple.net>, relay=local, delay=40, status=sent (maildir)

Jul  9 22:29:59 src@azul postfix/smtpd[1199]: disconnect from localhost[127.0.0.1]

```

kashani

----------

## jfb3

Jul 10 00:50:59 [postfix/master] warning: /usr/lib/postfix/smtpd: bad command startup -- throttling

Jul 10 00:51:59 [postfix/smtpd] fatal: open database /etc/mail/aliases.db: No such file or directory

Jul 10 00:52:00 [postfix/master] warning: process /usr/lib/postfix/smtpd pid 2830 exit status 1

Jul 10 00:52:00 [postfix/master] warning: /usr/lib/postfix/smtpd: bad command startup -- throttling

...over and over...

----------

## kashani

Should of have you pull the logs to begin with. 

/etc/init.d/postfix stop

vi /etc/mail/aliases

/usr/bin/newaliases

/etc/init.d/postfix start

That should take care of the problem.

kashani

----------

## jfb3

There was never any mention (that I remember) in the postfix documentation of needing to issue that command.  It all works now.  

Thanks again.

/John

----------

## kashani

There's a message about it after the emerge finishes. You probably missed it if you installed several things at once. No worries.

```

ewarn "You must edit /etc/mail/aliases to suit your needs and then run"

ewarn "/usr/bin/newaliases. Postfix will not work correctly without it."

```

kashani

----------

## shiftzero

I've got the same problem. Outgoing mail is OK. Authenticating is OK. Incoming mail arrives to the spool (/var/spool/postfix/deferred) directory under referred, but never makes it to the maildirs, so neither pop, imap or mutt get any mail. 

btw: using postfix with courier-imap for pop3 and imap

a fragment of /var/log/mail/current:

```

Aug  3 12:28:50 [postfix/qmgr] B67AF243C4: to=<x@mail.digitalflow.info>, orig_to=<x>, relay=none, delay=395512, status=deferred (unknown mail transport error)

Aug  3 12:28:50 [postfix/qmgr] D4873243A5: to=<x@mail.digitalflow.info>, orig_to=<x>, relay=none, delay=413993, status=deferred (unknown mail transport error)

Aug  3 12:28:50 [postfix/qmgr] D4873243A5: to=<x@localhost.digitalflow.info>, orig_to=<x@localhost>, relay=none, delay=413993, status=deferred (unknown mail transport error)

```

also:

```

Aug  3 12:59:20 [postfix/qmgr] 41015249AE: to=<x@digitalflow.info>, relay=none, delay=187215, status=deferred (unknown mail transport error)

Aug  3 12:59:20 [postfix/qmgr] 4A8D3249A9: from=<xmame-admin@toybox.twisted.org.uk>, size=2767, nrcpt=1 (queue active)

Aug  3 12:59:20 [postfix/qmgr] 4A8D3249A9: to=<x@digitalflow.info>, relay=none, delay=222910, status=deferred (unknown mail transport error)

Aug  3 12:59:20 [postfix/qmgr] 4FDEA2498F: from=<xmame-admin@toybox.twisted.org.uk>, size=2846, nrcpt=1 (queue active)

Aug  3 12:59:20 [postfix/qmgr] 4FDEA2498F: to=<x@digitalflow.info>, relay=none, delay=286398, status=deferred (unknown mail transport error)

Aug  3 12:59:20 [postfix/qmgr] 45C002446A: from=<xmame-admin@toybox.twisted.org.uk>, size=3113, nrcpt=1 (queue active)

Aug  3 12:59:20 [postfix/qmgr] 45C002446A: to=<x@digitalflow.info>, relay=none, delay=420313, status=deferred (unknown mail transport error)

Aug  3 12:59:20 [postfix/qmgr] 4723B243AF: from=<xmame-admin@toybox.twisted.org.uk>, size=2871, nrcpt=1 (queue active)

Aug  3 12:59:20 [postfix/qmgr] 4723B243AF: to=<x@digitalflow.info>, relay=none, delay=412344, status=deferred (unknown mail transport error

```

from the default postfix/main.cf I just changed mydomain, myhostname (which I just put the same because the ip of the domainname is the same), mydestination, mynetworks, inet_iterfaces set to all.

Everything else is default.

Also when testing smtp:

```

 telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 digitalflow.info ESMTP Postfix

mail from: x@digitalflow.info

250 Ok

rcpt to: x@digitalflow.info         

250 Ok

data

354 End data with <CR><LF>.<CR><LF>

añlskdjfl

ñalksdñlfakj

añlskdfj

.

250 Ok: queued as 3598D2441D

```

I don't know what I'm missing.

----------

