Troubleshooting

General troubleshooting tips

  • Run "postfix check" to make Postfix look for obvious configuration errors. If it returns no output then no problem was found.
  • Read your /var/log/mail.log and look for warnings and errors.

Common problems and solutions

ClamAV fails to scan for viruses

May  7 12:42:28 debian amavis[1834]: (01834-01) (!)run_av (ClamAV-clamd) FAILED - unexpected , output="/var/lib/amavis/tmp/amavis-20110507T124228-01834/parts: lstat() failed: Permission denied. ERROR\n"

You forgot to run

adduser clamav amavis

Missing indentation in the master.cf

The /etc/postfix/master.cf file needs proper indentation. The first line of each service starts in the first column. Additional lines of the same service need to be indented by spaces.

Postfix keeps unwanted emails in the queue

Check that you do not keep soft_bounce enabled. If "postconf soft_bounce" shows "yes" then run "postconf soft_bounce=no".

I get "Permission denied" from Dovecot in the mail.log file

You have the permissions wrong. Run:

chmod -R vmail:vmail /var/vmail

General questions

Why is the database not normalized (email addresses with domain in virtual_users table)?

It's possible to normalize the database and use the JOIN syntax to get the domain name from the virtual_domains table. But that would lead to string operations when Postfix and Dovecot look up a certain email address. This quickly becomes a performance penalty when you have many users. So in this case performance wsas rated higher than strict normalisation.

18 Comments

unsupported dictionary type: smtp-amavis

Hello,

First let me say that this is the best written 'How To' I have seen as long as I can remember.

I suspect the root cause of my issue, is trying to do it while my 8 year old was demanding my attention. Anyway here is where I am at.

postfix check returns nothing. (Good)

I can send email to my account from the command line of the mail server and see it in mutt.

I can send email from a remote server, but it does NOT show up in my mailbox. (No bounce as of yet either.)

When I check the logs, I see this everywhere:

Jun 30 17:51:42 mail postfix/smtpd[21132]: fatal: dict_open: unsupported dictionary type: smtp-amavis:  Is the postfix-smtp-amavis package installed?

Jun 30 17:51:43 mail postfix/master[13324]: warning: process /usr/lib/postfix/smtpd pid 21132 exit status 1
Jun 30 17:51:43 mail postfix/master[13324]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
 
Google is not helping using keywords from those log entries.
 
What next?
 
Thanks

Can't connect to local MySQL server through socket

Hi. 

Excelent manual in a plain english. I highly appreciate your work. Following your manual I created working mail server and it was working just fine during 2-3 months of its existence. But, it is the second week that I have problems with postfix and mysql. I don't know what has happened with the server (because I am not an administrator of the server) but I am getting  'Can't connect to local MySQL server through socket' error. 

I am trying to fix it out for 2 weeks but without any positive results. Could you please give me some hints? Here is the /var/log/mail.log content:

Nov 15 23:19:43 ns1 dovecot: dovecot: Killed with signal 15 (by pid=24723 uid=0 code=kill)
Nov 15 23:19:43 ns1 dovecot: Dovecot v1.2.9 starting up (core dumps disabled)
Nov 15 23:19:43 ns1 dovecot: auth-worker(default): mysql: Connected to localhost (mailserver)
Nov 15 23:19:48 ns1 postfix/postfix-script[24744]: refreshing the Postfix mail system
Nov 15 23:19:48 ns1 postfix/master[9241]: reload -- version 2.7.0, configuration /etc/postfix
Nov 15 23:19:48 ns1 postfix/trivial-rewrite[24748]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Nov 15 23:19:48 ns1 postfix/trivial-rewrite[24748]: fatal: mysql:/etc/postfix/mysql-virtual-alias-maps.cf(0,lock|fold_fix): table lookup problem
Nov 15 23:19:49 ns1 postfix/qmgr[23121]: warning: problem talking to service rewrite: Success
Nov 15 23:19:49 ns1 postfix/master[9241]: warning: process /usr/lib/postfix/trivial-rewrite pid 24748 exit status 1
Nov 15 23:19:49 ns1 postfix/master[9241]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Nov 15 23:19:49 ns1 postfix/smtpd[22322]: warning: problem talking to service rewrite: Connection reset by peer
 
In all /etc/postfix/mysql-*.cf files I changed hosts=127.0.0.1 to hosts=localhost. Because with hosts=127.0.0.1 while executing 'postmap -q jhon@example.com mysql:/etc/postfix/mysql-email2email.cf' I am getting 'postmap: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)' error. 
 
Thank you

solved

All right, I am sorry. All the problem was in rules applied in iptables. After correcting those rules everything has come back to work.

Hello again

I have set everything up and it is working great, I can use mutt to access both IMAP and telnet to access the smtp to send emails with authentication, everything works great. I even tried from a different linux machine and the results were great.

There is one issue though, none of the User interfaces I've tried works with my server.

Microsoft Outlook
Mail (Apple)
iPhone Mail

and this is a problem, shouldn't that work? when it works for an external adress to use mutt to get onto my imap?

I try to use mail.mydomain.com and same username/password I used in mutt to get in.

Keep getting this

 

 
Nov 24 19:40:58 mydomain-server dovecot: imap-login: Login: user=<me@example.com>, method=PLAIN, rip=(100.100.100.100 my public ip), lip=10.0.1.2
Nov 24 19:40:58 mydomain-server dovecot: IMAP(me@example.com): Disconnected: Logged out bytes=71/884
 
I dont get any deny from the server, just that it wont work.

Thanks for a great tutorial, much appriciated

Somehow, I've got to the

Somehow, I've got to the conclusion that the IMAP seem to work, but not the SMTP, I've not got the SMTP to work on my Mac, using authentication "password", I dont know what that means, but I suppose it is plain. There are some other options as well, but I dont know how to configure this. Gmail itself cannot connect to the smtp neither.

Is there something i got wrong or is there something I need to do before this will work?

Discovered that SMTP works on

Discovered that SMTP works on local network, but when I get on another network it stops working. So rule one gets applied that I'm in the same network I suppose.

What could solve this issue, I use authentication through username (myemail@example.com) and password from mysql. And somehow I dont get properly authed. Even though I use the settings password, in my iphone, mac or similar in pc.

 

My SMTP does let me enter

My SMTP does let me enter through telnet and auth using encode base64 for the username and password.

This is what I do:
telnet mail.mydomain.com 25
helo mydomain.com
auth login
334 VXNlcm5hb6W
DASJKDJASLKFJ== (my email in base64)
334 UGFzc
d558dfjhift75== (my password in base64)
235 Authentication successful
mail from: me@mydomain.com
OK
rcpt to: someone@some-other-domain.com
OK

At this stage if I'm not logged in I get relay error, which is great, as I dont want an open relay. But when I try to telnet from my mobile phone, or more precisely try to telnet to my server from my computer using my phones internet connection. I don't get any connection at all, I can ping the server though.

telnet mail.mydomain.com 25
Trying 191.323.232.133... 

And it just pauses here, and my postfix never reach the message and therefore nothing is posted in the logs. I'm sure i opened the port to port 25, as I have done that for all other ports the same way. Opened TCP 25.

Do you have any information what could cause this.

Thanks a milion,
Yours
A newstarter, who loves this guide

You could be on to something,

You could be on to something, I havn't had any of those issues with nothing else.

So, I see three options,
Change port from 25 (which is not very good I suppose)
Ask my ISP to unlock it (which doesn't seem to have very high probability)
Use some external smtp (which I do not prefer)

Ouch, tough choices here, I have to check with my ISP.

Possible fix seems to be to use :2525 from outside, and forward it to :25, I think that could do. As a start.

Thanks, I didn't even know that could be an issue.

Thanks for a great guide as well!

Evil (mobile) ISP!

Yes, mine (3 UK) blocks port 25 but I managed to waste an entire afternoon tearing my firewall rule set apart before I realised this. The clue was that the firewall blocking wasn't showing up in the log, which I failed to spot. I routed external port 587 (commonly used) to internal port 25 and then everything worked.

HTH!

All Messages Send From root@fqdn

I can both send and receive messages, but the messages I send are always sent from root@<myServers.FullyQualifiedDomain.name> What do I need to do to get the messages to be sent from the user on the virtual domain that wrote them?

Thank you for the great tutorial. Without it, I would never have gotten this far.

Similar problem

I have the same problem. If use mutt to check if sending works, mutt sends email from root@mydomain.de
Good is, that sending works so far ;)
Do I have to create some system users?! I think it's not nessecary, if i'm using virtual domains?!

Another problem I have, is that I can't receive mails. I've got an MX record, that's calles mail@mydomain.de
Do I have to enter this domain name to make it know to postfix?
If I check if the MX record is working via host -t MX mydomain.de
I get the message:
mydomain.de mail is handled by 10 mail.mydomain.de.

If I now send mails to my server (from gmx) it get MAILER-DAEMON:
Sorry,_I_couldn't_find_a_mail_exchanger_or_IP_address._(#5.4.4)/

Thanks for your reply and your REALLY GREAT tuturoial!! :)
Beste regards
Jan

ISPmail tutorial for Debian Squeeze

I'm stuck at the stage of "Testing email delivery". When I enter the command find / var / vmail I do not get the result. In / var / log / mail.log the following entry:

Feb 4 14:17:58 debian6 postfix/cleanup[1813]: warning: CEA7BB54: virtual_alias_maps map lookup problem for john@domain.com
Feb 4 14:17:58 debian6 postfix/pickup[1811]: CF72FB54: uid=0 from=<root>
Feb 4 14:17:58 debian6 postfix/cleanup[1815]: warning: mysql query failed: Table 'mailserver.view_users' doesn't exist
What does this mean? Please Help?

db issue

Hi,
I think you confused something there. You should rename the table from view_users into vitual_users.
This should do it:

mysql -u root -p
<ENTER MYSQL-ROOT-PW>
RENAME TABLE 'mailserver.view_users' TO 'mailserver.virtual_users';
exit

Joh

Cannot recieve mails

Hi,
thanks for the work.
I have issues recieving emails. I am sitting inside the network of an university and I am having some weird behaviour. I can send mails from johannes@mydomain.de and they all reach their destination. When I answer them I do not always get mails back. Not always means: If the answer comes from the mailserver of my university (same 255.255.0.0 subnet) I recieve it. When I send from Gmail or GMX I dont recieve it at all.
Is my university blocking some ports inbound or am just not getting how mail servers work??
The /var/log/mail.log by the way is not showing any signs of rejected mails (actually it is not showing anything at all when emails come from outside this 255.255.0.0 net).
Do you guys have any idea?
Joh

PS: BTW: I had the same issues with iRedMail.