POP3 + MySQL strange problem

Discussion in 'Installation/Configuration' started by hammer, Jul 15, 2006.

  1. hammer

    hammer New Member

    Hi there, i have a problem using pop3 + mysql, everything should run but ... ofcourse this is not the case, even google said that he never saw something like this :)

    log file:
    other than the problem i see (in the bold) i dont see anything else wrong :(


    HELP!?!!?!?

    here is my main.cf



    here is my courier mysql config
    and the daemon rc of the courier

    directory permissions: /home/

    drwxr-xr-x 4 vmail users 96 Jul 15 10:21 vmail

    directory permissions: /home/vmail/
    drwxrwxrwx 5 vmail vmail 120 Jul 15 10:21 .maildir
    drwxr-xr-x 3 vmail users 72 Jul 15 10:11 .hammer

    directory permissions: /home/vmail/.maildir/
    drwx------ 2 vmail users 48 Jul 15 10:21 cur
    drwx------ 2 vmail users 48 Jul 15 10:21 new
    drwx------ 2 vmail users 48 Jul 15 10:21 tmp



    HELP! :)
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Is /home/vmail/.maildir/ that user's Maildir? Shouldn't it be in /home/vmail/example.com/user/.maildir/ or something like that?
     
  3. hammer

    hammer New Member

    i dont think so, i mean the home mail dir is /home/vmail, and the user maildir is .maildir/ so in the end it should say: /home/vmail/.maildir/
    Atleast i think so ... can i check somewhere to what dir is the daemon trying to "cd"
     
  4. falko

    falko Super Moderator Howtoforge Staff

    But then you can only have one mailbox on your server...
    What's in /etc/postfix/mysql-virtual-maps.cf?
    Did you have a look at this tutorial? http://www.howtoforge.com/virtual_postfix_mysql_quota_courier
     
  5. hammer

    hammer New Member

    here is virtual maps:

    user = mailsql
    password = blabla
    dbname = mailsql
    table = users
    select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
    where_field = email
    additional_conditions = and postfix = 'y'
    hosts = unix:/tmp/mysql.sock
    ...

    @But then you can only have one mailbox on your server...
    No this is just for testing. Later i will change the home dir for each user as needed.


    @Did you have a look at this tutorial? http://www.howtoforge.com/virtual_po..._quota_courier

    No i have read the gentoo tutorial for my MTA
     
    Last edited: Jul 17, 2006
  6. falko

    falko Super Moderator Howtoforge Staff

    In this tutorial I use

    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    table = users
    select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
    where_field = email
    hosts = 127.0.0.1
    which looks similar to your code, and emails get stored in /home/vmail/[email protected]/..., if I remember correctly...
     
  7. hammer

    hammer New Member

    Problem Solved ... permissions .. ofcourse! i've changed the uid and gid of the user to match the vmail user/group and everything works now ... BTW is this safe?

    And the final problem is the delivery ... smtpd delivers my mail to /home/$user/.maildir/
    instead of the /home/vmail/opasnivremena.com/$user/.maildir/

    The log file says that it retrieves a valid maildir entry:

    Jul 18 15:13:54 opasnivremena postfix/smtpd[20448]: dict_mysql_get_active: found active connection to host unix:/tmp/mysql.sock
    Jul 18 15:13:54 opasnivremena postfix/smtpd[20448]: dict_mysql: successful query from host unix:/tmp/mysql.sock
    Jul 18 15:13:54 opasnivremena postfix/smtpd[20448]: dict_mysql_lookup: retrieved 1 rows
    Jul 18 15:13:54 opasnivremena postfix/smtpd[20448]: maps_find: local_recipient_maps: mysql:/etc/postfix/mysql-virtual-maps.cf(0,100): hammer = /home/vmail/opasnivremena.com/hammer/.maildir/
    Jul 18 15:13:54 opasnivremena postfix/smtpd[20448]: mail_addr_find: [email protected] -> /home/vmail/opasnivremena.com/hammer/.maildir/


    But still it delivers the mail to /home/$user/.maildir/

    Why is that?

    More info:
    When i added a virtual mail user test at opasnivremena.com ... everything was fine. I've sended a mail. But when tried to receive mail i got this in the log:

    Jul 18 15:27:42 opasnivremena postfix/smtpd[22286]: maps_find: local_recipient_maps: mysql:/etc/postfix/mysql-virtual-maps.cf(0,100): test = /home/vmail/opasnivremena.com/test/.maildir/
    Jul 18 15:27:42 opasnivremena postfix/smtpd[22286]: mail_addr_find: [email protected] -> /home/vmail/opasnivremena.com/test/.maildir/

    Jul 18 15:27:42 opasnivremena postfix/local[22314]: 83FA53720A: to=<[email protected]>, relay=local, delay=0, status=bounced
    (maildir delivery failed: create /home/test/.maildir/tmp/1153225662.P22314.opasnivremena.com: Permission denied)

    why is smtpd so desperade to send my mail to other than the specified by me, folder?

    my smtpd config is:

    mech_list: PLAIN LOGIN
    pwcheck_method: auxprop
    auxprop_plugin: sql
    log_level: 7

    sql_engine: mysql
    sql_hostnames: localhost
    sql_user: mailsql
    sql_passwd: blabla
    sql_database: mailsql
    sql_verbose: yes
    sql_select: select clear from users where email='%u'


    Obviously the mysql connection is active and working properly otherwise smtpd wouldnt receive the
    Jul 18 15:27:42 opasnivremena postfix/smtpd[22286]: mail_addr_find: [email protected] -> /home/vmail/opasnivremena.com/test/.maildir/

    the question is why is he igrnoring the maildir i've setted up?!
     
    Last edited: Jul 18, 2006
  8. falko

    falko Super Moderator Howtoforge Staff

    Hm... You should compare your config files with the ones from the tutorial you followed. Take care about the formatting of the files and also about the permissions described in the tutorial.
     
  9. hammer

    hammer New Member

    Everything looks fine, i've checked twice :( ... Can you be more specific? From where could this problem be? My guess is my smtpd is messed up ... but i dont know what exactly is messed up .. help again :)
     
  10. falko

    falko Super Moderator Howtoforge Staff

    I think the problem might be somewhere in your .cf files or in your database.
     
  11. hammer

    hammer New Member

    The darn problem was because i didnt have an virtual_domain_maps assigned ... i've also removed the domain from mydestination so it can be treated as virtual domain. And everything worked out perfectly :)
     

Share This Page