Visit Atmail.com   Community Forums
Recent Changes - Search:
Atmail 5 Additional
Custom Login Pages
Page last modified by on September 30, 2009, at 08:26 PM

1.  Introduction

Customizing the login and sign-up screens in Atmail is a simple and effective way of branding Atmail and incorporating it into your web-site theme. It can be done on a per-domain basis allowing you to provide a unique Webmail service for several domains, while still only having one copy of Atmail installed on your server.

1.1  Background Information

The login page for Atmail can be found in :

 /usr/local/atmail/webmail/html/english/login.html

1.2  Language Support

Atmail uses a language template system to make it easier for translation. If you are using a language other than english, you must edit the following pages:

 /usr/local/atmail/webmail/lang/html/login.html

If you require multilingual support in Atmail you will need to build the interface after you have modified it. Please see http://support.atmail.com/language.html for more information

1.3  Variables

Variables are need for Atmail to function correctly. Within the HTML template the you will see text similar to:

 $var[EmailSubject]or $atmail→username, etc.

Please do not alter these strings, they are required for Atmail to function.

1.4  Incorporating a login page for an existing site

You can build the Atmail login page into an existing page by adding the following HTML code :

 <FORM action="atmail.php" method="post" name="loginPage" target="_top">

  <font>E-Mail Name</font>

  <INPUT name="username" size="9" value="$var[username]">
       @
  <select name="pop3host"> $var[domainbox] </select>

  <font>Password</font>

  <INPUT name=password type=password>

  <font>Interface</font>

   <select name="LoginType">
   <option value="simple">Simple (Any browser)</option>
   <option value="xp">Advanced (IE6+)</option>
   </select>
  <font>Options</font>
   <select name="Language"> <option value="" selected>Default</option> $var[languagebox] 
   </select>
     $var[mailtype]
  <input class="submito" type="submit" name="Login" value="Login">

 </form>

Or the following for Atmail in Client mode :

 <FORM action="atmail.php" method="post" name="loginPage" target="_top">

  <font>E-Mail Name</font>

  <INPUT name="username" size="9" value="$var[username]">
   @
  <input type="text" name="pop3host" value="$var[pop3host]" size="15">

  <font>Password</font>

  <INPUT name=password type=password>

  <font>Interface</font>

   <select name="LoginType">
   <option value="simple">Simple (Any browser)</option>
   <option value="xp">Advanced (IE6+)</option>
   </select>

  <font>Options</font>
  <select name="Language"> <option value="" selected>Default</option> $var[languagebox] </select>
     $var[mailtype]
  <input class="submito" type="submit" name="Login" value="Login">

 </form>

1.5  Direct login from existing site

If your users have to sign in to your web-site before they have access to Atmail, your users can have one click access to Atmail, without having to type in all their details again (as long as their login / pass details are the same for both).

The following is the full URL to access Atmail:

 http://server.com/atmail.php?username=username&password=password&pop3host=domain.com&LoginType=xp&Language=english

You may want to hard code domain.com , xp and english if your users only use one server, login type and language ( specify fields as a hidden field in a <form> ) Remember the use the POST method in the form to avoid sending the username/password in the URL.

You can replace username and password with the variables used to gain access to your main site. Make sure that the username and password is the same for both Atmail and your main site for this to work.

1.6  Creating unique login on per domain basis

Atmail is designed so that you can have different login and signup pages for each domain. Using the Atmail Subadmin, you can delegate control of a domain-name and the branding for the site to another SubAdmin account.

To create unique login / signup page, follow the steps below:

  • Edit your httpd.conf
  • Copy /usr/local/atmail/webmail/html/english/login.html to /usr/local/atmail/webmail/html/vhosts/domain-name.html
  • Customize the new login template for the domain-name

Editing httpd.conf:

Add the following for each <VirtualHost>

 Alias /webmail/ "/usr/local/atmail/webmail/"

You will need to restart Apache.

 root# apachectl restart

Copying login.html template

The standard HTML login template can be replicated into to the webmail/html/vhosts/domain-name.html directory. Where domain-name is the full host of the domain-name in the URL. Atmail will parse the server $ENV[HTTP_HOST]field and display the custom login page if available in the atmail/html/vhosts/ directory.

Next, edit the new template and replace the line :

<input type="text" name="pop3host" value="$var[pop3host]">

To the normal text name of your POP3/Mailserver hostname for the unique template.

Put a hidden variable of the POP3 host in the form (replace domain.com with your domain):

<input type="hidden" name="pop3host" value="domain.com">

If you have more than one POP3 host, use a select box :

 <select name="pop3host">
 <option value="$var[pop3host]">POP3domain.com</option>
 <option ....
 </select>

The select box will not require the hidden variable.

1.7  When the mailserver is different to the email-address domain

If your Mail Server has a Domain name of pop.domain.com , and your username is username@domain.com , you need to use the mailserver option.

 <input type="hidden" name="MailServer" value="pop.domain.com">

You can set the input type to Text if you want your users to type in the mailserver field manually.

2.  Examples

Here is a table of the fields we will be using in the examples, and what they do.

Field Remarks username the users name, e.g. bill@domain.com password the password field, with type=“password” the password is masked on the user's screen pop3host the domain name e.g. bill@domain.com MailServer the mailserver that Atmail connects to when the user's domain is not the same as the mailserver eg, user's address is bill@domain.com, but the mailserver is at mail.domain.com MailType the protocol that Atmail will use to attempt to connect to the mailserver, the default is POP3 LoginType the Interface that the either matches the user's browser type, or the user's selection. Language the Language chosen from the list of supported language packs.

Here are the example login pages, feel free to modify them for your own requirements

  • Standard Login
  • Select Box of Domains
  • Hardcoded Domain
  • Hard Coded Mailserver with User and Password login
  • Hardcoded MailServer, MailType - Javascript username/domain detection

Below are additional features for the custom login pages of Atmail.

JavaScript Browser detection

This detects the user's browser and selects the most appropriate WebMail interface for the users browser.

To enable this feature, the following Javascript can be added to the bottom of the login-page ( must be on the bottom to correctly parse the login form )

 <script language="JavaScript" src="http://demo.atmail.com/javascript/browsercheck.js"></script>

 <select name="LoginType">
 <option value="simple">Simple (Any browser)</option>
 <option value="xp">Advanced (IE6+)</option>
 </select>

The order of the LoginType select box is important - The browsercheck.js will select the most appropriate interface by the array-index of the select-box.

Language Selection

Please note that even if the Default language is set in Webadmin, the language selection should still be available for the user, otherwise the user will have to select their language every time they login.

3.  Related Articles

Browse related articles from our online Knowledge-base regarding the Login Customization guide