Postfix / Courier / MySQL cannot send email

I am using Slackware 10.2 using the default 2.4.31 kernel.

I have postfix 2.3 and courier-imap and courier-pop3  and MySQL 5.0 setup and working.  I can currently receive emails with no problems.

I cannot send emails with postfix when i connect directly to my mail server.  I also have other users who will be connecting to attempt to recv and send emails.  So there is no 1 domains or subnet to put in the /etc/postfix/ file.  I need to be able to use SMTP-AUTH to be able to authenticate and send email.

# postconf -a

comes back with


... I have downloaded and installed dovecot 1.0.10 but cannot get dovecot to run. I get the following error:

# dovecot

Error: Login user doesn't exist: dovecot
Fatal: Invalid configuration in /usr/local/etc/dovecot.conf

Here is my /usr/local/etc/dovecot.conf file

---- /usr/local/etc/dovecot.conf ----
auth default {
        mechanisms = plain login
        passdb sql {
                args = /usr/local/etc/dovecot-sql.conf
        userdb static {
                args = uid=2001 gid=1001 home=/usr/local/vmail/%d/%n
        socket listen {
                client {
                        path = /var/spool/postfix/private/auth
                        mode = 0660
                        user = postfix
                        group = postfix
---- EOF /usr/local/etc/dovecot.conf ----

If there is more information needed, please let me know.  

I don't have to use DOVECOT but the setup i have can receive email and that took me a while to get setup and working with MySQL and would prefer to not have to change from courier to dovecot but if need be, i will do it.

Thanks for any help!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pétur Ingi EgilssonSoftware Engineer -- ConsultantCommented:
dovecot wants to run on it's own username\password
create a username : dovecot
create a group: dovecot

then : useradd -d /var/run/dovecot -s /bin/false -g dovecot -M -r -u 96 dovecot
jcullinsAuthor Commented:
the useradd statement didn't work, it said -r was an invalid option.

I manually created the user in /etc/passwd and the group in /etc/group and now when i try to execute dovecot it says:

Error: Can't use SSL certificate /etc/ssl/certs/dovecot.pem: No such file or directory

jcullinsAuthor Commented:
ok, here's an update. I created the certificates and put them in the directory where dovecot wants them but now when i run dovecot, i get the following message.

Fatal: listen(143) failed: Address already in use

This is telling me that it's trying to bind to port 143 which is the IMAP port. I understand that, but i am using courier as my imap and pop3 daemon's and need to make it so dovecot is used to just authenticate via SMTP_AUTH.

Let me know if you need more information.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

jcullinsAuthor Commented:
Ok i got everything figured out.  Here is the solution.

I started off with my original problem which got me further once i created the dovecot user and group.

then i had to do

openssl genrsa -des3 -out dovecot.pem in the /etc/ssl/certs and the /etc/ssl/private directories.

once that was complete i had to recompile dovecot to support mysql which isn't supported by default in the dovecot-1.0.10 version.

untar the dovecot package, the run

./configure --with-mysql
make install

this will install dovecot with mysql support.  You can double check this by running the following:

dovecot --build-options

if it comes back in the passdb and userdb lines with sql or mysql then you should be good to go! run dovecot from the command line and everything should start up just fine.

NOTE: before you run dovecot, if you are going to be using dovecot to be just for SMTP_AUTH for postfix, you must be sure to add the line "protocols = none" to your dovecot.conf file otherwise it will attempt to be your imap and pop3 daemons / servers.  In my specific case, i did not want that since i was already running courier as my imap and pop3d servers.

you can verify this by looking in the /var/log/messages file.  

then i had to edit my /etc/postfix/ file and add the following lines:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

once this was added, i had to setup my dovecot-sql.conf file.

---- /usr/local/etc/dovecot-sql.conf ----
driver = mysql
connect = host=<path/to/mysql.sock> user=<dbusername> password=<dbpasswd> dbname=<mysqldb>
default_pass_scheme = PLAIN
password_query = SELECT password FROM <mysqldbname> WHERE email = '%u'
---- EOF /usr/local/etc/dovecot-sql.conf ----

at first in the password_query section i didn't have SELECT password because i had the passwd in a different field.  Dovecot requires that it comes back as the "PASSWORD" field.  I originally had my passwords in a field called clear.  To prevent me having to reinvent the wheel i just created an additional field called password and duplicated the password entry from the "clear" field to the "password" field.

Hope this helps anyone else that may be having a problem.  There wasn't any one place that had all this information in one place.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pétur Ingi EgilssonSoftware Engineer -- ConsultantCommented:
the useradd statement didn't work, it said -r was an invalid option.
sorry, it was supposed to be a big -R
Closed, 500 points refunded.
EE Moderator
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.