You may need to make WebMail Pro interface a part of your web site interface. For example, if your web site has several sections (e.g. "My Blog", "My Pictures", "My Mail") and a navigation menu which should always stay on the screen (no matter which section is currently selected), webmail interface shouldn't overlap the navigation menu and shouldn't be opened in a separate window.
To achieve this, you need to place WebMail Pro interface into an IFRAME which is a part of your interface. Placing it directly into your interface (e.g. into a DIV element) is not possible as it's complex AJAX application which relies to absolute coordinates and has its own system of exchanging data packets with server. So, an IFRAME is the only way to get it working properly.
Note that it's possible to disallow placing WebMail Pro interface into IFRAME, see Preventing clickjacking attacks with X-Frame-Options header documentation page for details.
Simple embedding into your interface
The following example demonstrates how to place WebMail Pro interface into an IFRAME:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<div style="background-color: #EEE; width: 1000px;">Your navigation menu here</div><br />
<iframe src="http://webmail.afterlogic.com/" style="width: 1000px; height: 640px;"></iframe>
Here, you can see http://webmail.afterlogic.com/ URL mentioned. It points to AfterLogic WebMail Pro PHP live demo at our web site. You should change this URL to the one pointing to your product installation.
Note that in version 7, IFRAME height and width should be 640px at least, to avoid getting scrollbars.
Embedding into your interface along with passing authentication data
Now let's use visual integration along with passing authentication data to WebMail Pro which is described here. First, please create test-iframe.php file and copy/paste the code from Basic example section there, then modify the example to get it working in your environment. It's assumed that you placed that file into the integration subdirectory of your WebMail Pro installation (which, in turn, is found in webmail subdirectory of your website). The code will be slightly modified (see below).
Now, just add the following line to one of your PHP pages:
<iframe src="webmail/integration/test-iframe.php" style="width: 1000px; height: 640px;"></iframe>
Now, you may wonder how to pass authentication data from your PHP application to LoginToAccount method called in test-iframe.php. We won't pass those data through POST method, server-side PHP sessions are used instead. Example:
* index.php file:
// Store credentials in session
$_SESSION['email'] = 'firstname.lastname@example.org';
$_SESSION['password'] = 'mypassword';
<iframe src="webmail/integration/test-iframe.php" style="width: 1000px; height: 600px;"></iframe>
* webmail/integration/test-iframe.php file:
// Example of logging into user account using email and
// password for incorporating into another web application
// utilizing WebMail Pro API
if (class_exists('CApi') && CApi::IsValid())
// data for logging into account
$sEmail = $_SESSION['email'];
$sPassword = $_SESSION['password'];
// Getting required API class
$oApiIntegratorManager = CApi::Manager('integrator');
// attempting to obtain object for account we're trying to log into
$oAccount = $oApiIntegratorManager->LoginToAccount($sEmail, $sPassword);
// populating session data from the account
// redirecting to WebMail Pro main page
// login error
catch (Exception $oException)
// login error
echo 'AfterLogic API isn\'t available';