Mail server can't deliver mail properly why?

I have postfix setup with mysql and openssl and Dovecot. I have this mail server that works. I can send e-mails out and get e-mails. Here is the problem. Postfix when first installed uses the postfix system default. So my FreeBSD 8.1 users created with the OS like root, www, postfix, home folder user etc. I have my home folder user to be aaron. Now that's great and dandy but the default users created are with those that are users of the OS. so those mail gets stored in /var/mail location.

Yet, I have a mysql table that creates users or store users and their passwords. I created the user aaron and its mail is stored in /usr/local/virtual. Now I can send mail and recieve mail but for aaron it goes to /var/mail the default location. I then created another user named bob. his mail is stored at /usr/local/virtual. So both can't receive e-mails from the outside. It seems that postfix uses the default tree or table to route mail internally rather then use the mysql database table.

Any ideas on what to do?

When I try using my aol account to send mail or reply to e-mails sent by my bob user from my website here is what the errors say:

Code:
reason: 550 5.1.1 <bob@domain>: Recipient address rejected: 
User unknown in local recipient table)

I am using my mysql table to create virtual users and mailboxes. So I don't understand what this error means. It looks like it's checking the local table or postfix postmap for user bob. But dosen't find user bob. I have the user in mysql database but don't have the user created in the OS.

Any ideas?
 
Hi are those settings similar to yours:

Code:
virtual_alias_maps = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_base = /usr/local/virtual
virtual_mailbox_maps = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf
 
gkontos said:
Hi are those settings similar to yours:

Code:
virtual_alias_maps = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_base = /usr/local/virtual
virtual_mailbox_maps = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf

Yes, I have those set. Just found out the spool directory is /var/mail. I changed it to /usr/local/virtual. Seems like it's working, kind of. For users I have the user name as folders for example:

/usr/local/virtual/bob - bob is the folder name for that user. The folder has other folders inside called new, temp, trash etc.

Here is the error I get for trying to send mail to my mail server:

Code:
cannot update mailbox /usr/local/virtual/bob
    for user bob. cannot open file: Is a directory
what does this mean?
 
Hi,

/usr/local/virtual is a directory that contains the sub directories of your virtual domains.
Please post all the relevant entries from main.cf so that we can see better where the problem is.

George
 
gkontos said:
Hi,

/usr/local/virtual is a directory that contains the sub directories of your virtual domains.
Please post all the relevant entries from main.cf so that we can see better where the problem is.

George

Yes, the /usr/local/virtual is the location that dovecot creates the folders in that folder. So for example I made the user bob. You would see something like /usr/local/virtual/bob and in the mysql database I put that url link as the mailbox for that user like /usr/local/virtual.

In the main.cf file I just changed this:

Code:
mail_spool_directory = /usr/local/virtual
It had the /var/mail default location. So I changed it to /usr/local/virtual and now I can send e-mail to my virtual users instead of my OS users. Yet, I can't send e-mail from my aol account to this user. I get an error message.

That error message I get back to my aol account is this:

Code:
cannot update mailbox /usr/local/virtual/bob
for user bob. cannot open file: Is a directory
This is what Postfix sends back to my aol account when I try sending e-mail to that user. I don't know what that error message means. I am guessing that I need to reference a text file as the mailbox. I notice when you first login to the users mail via a mail client software tool. It creates the folders of that user in that /usr/local/virtual location.
 
Ok, maybe I am missing something here.

The following directory:

/usr/local/virtual

is where your virtual domains reside. Not mailboxes. So in this directory you should have a sub-directory called domain.tld. Inside domain.tld you should have another directory called bob.

Have a look at your dovecot.conf the value:
Code:
mail_location = maildir:/usr/local/virtual/%d/%n

Also, regarding the change that you made, I think it is wrong.

This is what you want:
Code:
queue_directory = /var/spool/postfix

This you don't want !!!
Code:
mail_spool_directory = /usr/local/virtual

Since you have this:
Code:
virtual_mailbox_base = /usr/local/virtual
 
Yes, I got that but just comment out mail_spool_directory. No, the /usr/local/virtual is where the mailboxes are stored. This is where the user folders are at, for instance user bob. I am using mysql with postfix.
 
Back
Top