+ Reply to Thread
Results 1 to 8 of 8

Thread: Automatically figuring out host with email login???

  1. #1
    blove57 is offline Registered User
    Join Date
    Nov 2007
    Posts
    18
    Downloads
    0
    Uploads
    0

    Default Automatically figuring out host with email login???

    I have users from many different domains logging into Roundcube webmail. Because of this I left this blank in main.inc.php:
    $rcmail_config['default_host'] = '';

    The problem is users find this really confusing when they have an emails address, password and host to fill out during the log in page. What I'd like to do is get the domain from the email loggin and place is in the $rcmail_config['default_host'] value. So for example, when someone logs in as john@fundomain.com, the host should automatically be valued at fundomain.com.

    In the wiki it says:
    // Automatically add this domain to user names for login
    // Only for IMAP servers that require full e-mail addresses for login
    // Specify an array with 'host' => 'domain' values to support multiple hosts
    // $serverut = $_SERVER['SERVER_NAME']; <<< get the server name example www.site.com
    // $wsrt = 'www.'; <<< string to replace
    // $serverput = str_replace($wsrt,'',$serverut); <<< replace the host address deleting the www in this case
    // $rcmail_config['username_domain'] = $serverput; <<< and the var is ready!

    The problem with this is that SERVER_NAME is already figured out before the users fills it their information. I want to fill the host value after the user has filled their information. How would I implement this?

  2. #2
    OJM
    OJM is offline Registered User
    Join Date
    Jan 2007
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Re: Automatically figuring out host with email login???

    This is exactly what I'd like to achieve aswell.

    Off the top of my head, the SMTP user authentication uses '%u' as the username of the account. Would it be possible to find out how this is being set, and add another function to strip off the @ sign and everything before? You could then use this new 'function' to pass through as the host name...?

  3. #3
    blove57 is offline Registered User
    Join Date
    Nov 2007
    Posts
    18
    Downloads
    0
    Uploads
    0

    Default Re: Automatically figuring out host with email login???

    I'm also trying to tackle this. The RoundCube code doesn't really seem to be coded for change. What I was going to do is hack the login page with Javascript. All I need to do is add an onsubmit to the form in roundcube\program\include\rcmail_template.inc. I was going to add it in this line "$form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : '';", but that just creates a 2nd form if I mess with the conditions.

    To get the domain from the email address, this is the formula I was going to use:
    document.getElementById('rcmloginuser').value.subs tring(document.getElementById('rcmloginuser').valu e.substring(0,document.getElementById('rcmloginuse r').value.lastIndexOf('@')+1).length,document.getE lementById('rcmloginuser').value.length+1)

    So all I have to do in the form is this (notice just the onsubmit):
    <form name="form" action="./" method="post" onsubmit="document.getElementById('rcmloginhost'). value = "mail." + document.getElementById('rcmloginuser').value.subs tring(document.getElementById('rcmloginuser').valu e.substring(0,document.getElementById('rcmloginuse r').value.lastIndexOf('@')+1).length,document.getE lementById('rcmloginuser').value.length+1)">

    Then I can make the 'rcmloginhost' input hidden. I'm getting closer but really need help from a RoundCube coder or guru. Any ideas?

  4. #4
    OhYa is offline Registered User
    Join Date
    Mar 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Re: Automatically figuring out host with email login???

    I need to do this as well...
    Anyone have any updates on this?

    Exactly what I need to do is this,
    I have several domains with a few users on each.
    So I need them to be able to login to a single webmail.MyMainDomain.com

    Thanks

  5. #5
    sebastian is offline Registered User
    Join Date
    Apr 2008
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: Automatically figuring out host with email login???

    Looking also for this feature ... but I need to configure different mail-servers according to the login.

    Like user1@domain1.com uses domain1-mail.somedomain.com; user2@domain2.com uses domain2-mail.somedomain.com, etc.

    Looking forward to such feature :-)

  6. #6
    Eamorr is offline Registered User
    Join Date
    Feb 2009
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by sebastian View Post
    Looking also for this feature ... but I need to configure different mail-servers according to the login.

    Like user1@domain1.com uses domain1-mail.somedomain.com; user2@domain2.com uses domain2-mail.somedomain.com, etc.

    Looking forward to such feature :-)
    It's tricky hacking the roundcube code -- all the localization and security features (session variables being cleare/cookies being cleared) makes life very difficult.

    I spent an afternoon hacking what I thought would be an easy-enough job. I've given up!

    I've 10 domains -- I'd like the 'domain' textfield to be auto-completed and hidden. All I want visible to the user is the fields 'username' and 'password'. Roundcube is accessed via: webmail.xxxx.com for each of the 10 domains...

    Hope someone can provide a nice solution,

  7. #7
    pesz1 is offline Roundcube Newcomer
    Join Date
    Mar 2010
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default

    This is an old thread but below is my workaround:

    $rcmail_config['default_host'] = str_replace("www.","",$_SERVER['SERVER_NAME']);

    I had to use str_replace b/c if the user typed www.domain.com/roundmail it would append that to their email address like user@www.domain.com.

  8. #8
    netbit's Avatar
    netbit is offline Roundcube Newcomer
    Join Date
    Mar 2008
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by blove57 View Post
    ... when someone logs in as john@fundomain.com, the host should automatically be valued at fundomain.com...

    ... I want to fill the host value after the user has filled their information. How would I implement this?
    This was implemented on changeset 4705 (Changeset 4705 ? Roundcube Webmail) and will be available on the next public release.

    --
    Victor Benincasa

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts