alternative mailbox login as optional field

Discussion in 'Developers' Forum' started by Croydon, Apr 20, 2011.

  1. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Currently ispconfig3 uses the email address of a mailbox as the login when using imap/pop3.
    This is my preferred option, but other control panels have a different aproach like using "web1p34" or even custom login names.

    Currently I think about migrating a server with quite a few users, webs and mail addresses from a customer-built controlpanel (similar to confixx) to ispc.
    Unfortunately the control panel uses custom email logins like web1p1 and sending each customer new access data is not really an option.

    So my idea is:
    Implementing an additional (and optional) field in ispconfig3 in the mailbox form allowing the admin (and customer?) to set a custom login for the mailbox.

    1.) This would require an additional db field "login" in the email database table. If no optional login name is given the email address is put into that field.
    2.) The courier authmysqlrc MYSQL_LOGIN_FIELD would change to "login" instead of "email"

    My question is if you (especially till and falko) think this is an option that should make it's way into the main ispconfig branch or should I just implement it for our own use?
    Are there any problems you think that will occur by doing these changes?

    Thank you
    Last edited: Apr 20, 2011
  2. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    I just completed changing my local repository copy of ispconfig the way I mentioned above.

    There are a lot of files that needed to be changed, so I did not want to commit to the svn repository without being sure to keep everything working.

    At some points I was not sure whether to change a line or not:
    user_query = SELECT email AS user, maildir AS home, CONCAT('*:storage=', quota , 'B') AS quota_rule FROM mail_user WHERE login = '%u' AND disable%Ls = 'n'
    I changed the WHERE column from email to login but I left the SELECT column as is.
    Is that correct or do I have to change it to "SELECT login AS user" ?
    I do not exactly know what the user_query user column is used for.

    The diffstat program states the following files as changed on my local copy:

    install/sql/incremental/upd_0009.sql (new file)
    19 files changed, 69 insertions(+), 25 deletions(-)

    I only have a debian squeeze server with courier to test and on that server it works as intended.
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    You can commit the changes to SVN if you like.

    There is one requirement though, the login field must be invisible by default so that it is not shown in the interface if this function is not explicitley activated in the server settings on the email tab. Otherwise it might confuse the existing users.

    I guess it has to be "SELECT login AS user", but I'am not 100% sure too.
  4. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    I have never worked with the server config settings before. Can you give me a hint in what files to look how it can be used?
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Add your config option the file interface/web/admin/form/server_config.tform.php and the corresponding template file. Then add it in install/tpl/server.ini.master

    You dont have to extend the mysql database, as these settings are stored in ini format.

    The server settings can be accessed then like this:

    $mail_config = $app->getconf->get_server_config($server_id,'mail');
  6. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Ok, I understand. But at the point of creating an email address I do not know on what server the address will be, so I cannot decide whether to show or to hide the additional field on a server-based config setting.
    Shouldn't the setting be a global one for all (mail)servers? And how can I set/read this one?
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    You are right, this should be set globally. The mechanism is similar, it is named system config instead of server config:


    $system_config = $app->getconf->get_global_config($section = '')
  8. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Ok, i uploaded it to the svn including german and english language file changes.
    Hope it works as intended for all systems, because it affects all updated installations, no matter if the additional input field is displayed or not.
    This is due to the needed changes in the config files and the additional database column.
  9. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    I tried to have a look in dovecot howtos and manual but i didn't find the "user" column mentioned anywhere.
    Could it be, that there is no (used) "user" column in the user_query - so it doesn't matter what data it has?
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    I dont remember where I've found that configuation. It might be that the filed is not used by all dovecot versions.

Share This Page