How to integrate WebMail into another system
WebMail can be easily integrated into any existing system.
To bypass WebMail's login screen and enter user's email account directly, it is
required to set up some data that identify user in WebMail system. WebMail
provides CIntegration object for this purpose.
Usage of CIntegration object is simple.
1. Include integr.php file
include('integr.php');
2. Create "CIntegration" object:
$Integr = new CIntegration($webmailrootpath = null);
$webmailrootpath - path to the WebMail root folder necessary for correct UserLogin method work.
3. Now, for instance, we need to log a user into WebMail bypassing standard login screen. Let's call UserLogin method for this purpose:
$Integr->UserLogin($email, $login, $password, $incHost, $outHost, $startPage, $incPort, $outPort, $useAuth, $toEmail);
$incPort, $outPort, $useAuth, $toEmail - optional parameter.
$startPage - a constant determining the screen the user will be redirected to after logging in.
See also Usage Example for details on user's account upates in WebMail system.
UserLogin($email, $login, $password, $incHost, $outHost, $startPage, $incPort, $outPort, $useAuth, $toEmail) | Performs login and redirects user into WebMail system.
$email, $login, $password, $incHost, $outHost - required parameters. $incPort, $outPort, $useAuth, $toEmail - optional parameter $startPage - a constant determining the screen the user will be redirected to after logging in. $toEmail - if you specify $startPage = START_PAGE_IS_NEW_MESSAGE to log into "compose message" screen directly, To field will be filled with this value. |
GetErrorString() | Gets the last error description. |
$startPage constants (determine the screen the user will be redirected to after logging in)
Value | Description |
START_PAGE_IS_MAILBOX | Message list screen. |
START_PAGE_IS_NEW_MESSAGE | Compose message screen. |
On the PHP page you want to launch WebMail from, add the lines similar to the following:
<?php
include('integr.php');
$Integr = new CIntegration();
$email = 'login@domain.com';
$login = 'login';
$pass = 'password';
$pop3server = 'pop3.domain.com';
$smtpserver = 'smtp.domain.com';
$Integr->UserLogin($email, $login, $pass, $pop3server, $smtpserver);
?>
The code above will redirect to WebMail system and immediately open "login@domain.com" mailbox.
If you have any questions don't hesitate to email to support@afterlogic.com
Or visit our support web page at http://www.afterlogic.com/support
or web forum at http://www.afterlogic.com/forum