How to use MYSQL_NAME_FIELD in authmysqlrc

Discussion in 'HOWTO-Related Questions' started by vitor, Sep 14, 2010.

  1. vitor

    vitor New Member

    Hello!
    I have set up a mail system accordingly http://howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-fedora-13-x86_64
    everything works fine.

    But i would like to know if its possible to add a new field name to users table
    and use it as mail sender/recipient name?

    What i did:
    I have uncommented MYSQL_NAME_FIELD in authmysqlrc and pointed required field name, added to the table USERS new field name, filled it.

    Like this:
    MYSQL_NAME_FIELD name

    After restarting the server i mailed a sample letter but sender was e-mail address not the name from table users.

    Would you be so kind to answer my question :)
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Can you post your authmysqlrc?
     
  3. vitor

    vitor New Member

    Sure!

    Here it is...

    MYSQL_SERVER localhost
    MYSQL_USERNAME mail_admin
    MYSQL_PASSWORD xxxxxxxx
    MYSQL_PORT 0
    MYSQL_DATABASE mail
    MYSQL_USER_TABLE users
    MYSQL_CRYPT_PWFIELD password
    #MYSQL_CLEAR_PWFIELD password
    MYSQL_UID_FIELD 5000
    MYSQL_GID_FIELD 5000
    MYSQL_LOGIN_FIELD email
    MYSQL_HOME_FIELD "/home/vmail"
    MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
    MYSQL_NAME_FIELD name
    MYSQL_QUOTA_FIELD quota

    I also turned DEBUG_LOGIN=2 in /etc/authlib/authdaemonrc
    to watch mail log for reading "name" field from table.

    Here some of it, hope it would help

    Sep 16 00:03:18 mail authdaemond: received auth request, service=smtp, authtype=login
    Sep 16 00:03:18 mail authdaemond: authmysql: trying this module
    Sep 16 00:03:18 mail authdaemond: SQL query: SELECT email, password, "", 5000, 5000, "/home/vmail", CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/'), quota, name, "" FROM users WHERE email = '[email protected]'
    Sep 16 00:03:18 mail authdaemond: password matches successfully
    Sep 16 00:03:18 mail authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, [email protected], fullname=Vedischev V.N., maildir=domain.ru/vvedischev/, quota=209715200, options=<null>
    Sep 16 00:03:18 mail authdaemond: authmysql: clearpasswd=<null>, passwd=BAcr3ni.MG.eY
    Sep 16 00:03:18 mail authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, [email protected], fullname=Vedischev V.N., maildir=domain.ru/vvedischev/, quota=209715200, options=<null>
    Sep 16 00:03:18 mail authdaemond: Authenticated: clearpasswd=xxxxxxxx, passwd=BAcr3ni.MG.eY


    here we can see fullname takes exact meaning of name field from user table.

    But sender's/recipient's name goes e-mail anyway.
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Ah, now I understand what you're trying to do. You must set the sender name in your email client, and besides, authmysqlrc is used by Courier which just fetches mails from your mailbox via IMAP/POP3. Postfix is used for sending mails.
     
  5. vitor

    vitor New Member

    Yes i know i should set sender's name in my mail client to see it.

    But i would like to know if it is possible for postfix to send name that courier reads from users table without setting user's name in e-mail client?

    If its possible i would like to know how i can do it.
     
  6. falko

    falko Super Moderator ISPConfig Developer

    I don't think this is possible...
     
  7. vitor

    vitor New Member

    Anyway, Falko, thanks a lot for answers and tutorials of course!!!
     

Share This Page