help centre
For more info visit status.atmail.com

How can we help?


Search our knowledge base for answers to
common questions and latest updates.



My activities New request

Follow

Auto-detect domain name in login page

Nathan Salt -

PROBLEM

Auto detect domain name

ENVIRONMENT

  • On-Premise Server + WebMail Installations: Version 6.0 > 7.5
  • Webmail Only Installations: Version 6.0 >7.5

CAUSE

Does not detect domain name at login

RESOLUTION

To make Atmail detect the hostname of your Atmail URL, and make it automatically detect the domain name for the login page, do the following:

- open up /usr/local/atmail/webmail/application/modules/mail/views/scripts/auth
index.phtml

- find this line block:

$("#loginPage").bind('submit', function() {
email = $("#email").val();
//alert(email);
emailArgs = email.split('@');
//alert(emailArgs[0] + ":" + emailArgs[1]);
$("input[name=emailName]").val(emailArgs[0]);
$("input[name=emailDomain]").val(emailArgs[1]);

Change this to:

$("#loginPage").bind('submit', function() {
email = $("#emailName").val() + "@" + $("#emailDomain").val();
emailArgs = email.split('@');
$("input[name=emailName]").val(emailArgs[0]);
$("input[name=emailDomain]").val(emailArgs[1]);

Then, find:

RememberMe();

Below this, add:

emailDom = window.location.host.substring(8);
$("#emailDomain").attr('value', emailDom);

Note the number "8". This assumes that you use webmail.domain.com for your Atmail vhost. If you are using another Alias like mail.domain.com, the number will change from the number of the letters in the Alias plus one - making it:

emailDom = window.location.host.substring(5);

Then, find:

<tr>
<td>
<label class="user"><?php print $this->translate('Email') ?>:</label> <input id="email" class="input-email" type="text" name="email" tabindex="1" />
</td>
</tr>

Change to:

<tr>
<td>
<label class="user"><?php print $this->translate('Email') ?>:</label> <input id="emailName" class="input-email" type="text" name="emailName" tabindex="1" />
</td>
</tr>
<tr>
<td>
<label class="user"><?php print $this->translate('Domain') ?>:</label> <input id="emailDomain" class="input-email" type="text" name="emailDomain" tabindex="1" />
</td>
</tr>

This will then auto-fill the login page with the domain part of the URL entered.

Have more questions? Submit a request

Comments


Contact our support team


+61 (7) 5357 6605       support@atmail.com