If you have some existing web application, you might want to integrate WebMail Lite 8 into it. It is possible to send authentication data from your application into WebMail Lite 8 bypassing its login screen.
In order to make use of WebMail Lite 8 API, you'll need to initialize it as follows:
It is assumed that the code itself is located in a subdirectory of main WebMail Lite 8 directory. If that's not the case, you'll need to adjust the filesystem path which points to
autoload.php file. And of course, you can supply full filesystem path there, e.g.:
In order to log specified user into their email account, Login method of Core module is used. It takes 2 parameters: email address and account password.
Below, please find sample code for logging a particular user into WebMail Lite 8. For the sake of simplicity, email and password are supplied directly in the code. In actual application, they will probably be taken from session, POST data, etc.
$sUserLogin = "email@example.com";
$sUserPassword = "MyPassWord";
$aData = \Aurora\System\Api::GetModuleDecorator('Core')->Login($sUserLogin, $sUserPassword);
$sAuthToken = $aData['AuthToken'];
setcookie('AuthToken', $sAuthToken, time()+3600, "/");
Note the line with
Api::Location method call. Upon logging user into their account, WebMail Lite 8 interface needs to be opened, and this line does that. Once again, it's assumed that the code itself is located in a subdirectory of main WebMail Lite 8 directory. You can supply absolute or relative URL (NOT the path) pointing to your WebMail Lite 8 installation there.
In general, logging in programmatically and logging in using main WebMail Lite 8 page use the same idea: