Author |
|
iSofia Newbie
Joined: 24 May 2014 Location: Singapore
Online Status: Offline Posts: 35
|
Posted: 24 May 2014 at 9:48am | IP Logged
|
|
|
Hello. Hope you could help.
My WebMail is installed in a sub-domain, mail.domain1.com, and it works well. Now, I'm trying to use the example script to log in from an external page, which is located in another sub-domain, mail.domain2.com. So far, I have managed to get the API location, but I'm stuck at the CApi::Location to launch the client after a successful login.
This is the php script which runs in mail.domain2.com:
Code:
<?php
include_once '/home/sofia/public_html/mail.domain1.com/libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid())
{
$sEmail = $_POST['email'];
$sPassword = $_POST['password'];
try
{
$oApiIntegratorManager = CApi::Manager('integrator');
$oAccount = $oApiIntegratorManager->LoginToAccount($sEmail, $sPassword);
if ($oAccount)
{
$oApiIntegratorManager->SetAccountAsLoggedIn($oAccount);
//CApi::Location('../');
CApi::Location('/home/sofia/public_html/mail.domain1.com');
}
else
{
echo $oApiIntegratorManager->GetLastErrorMessage();
}
}
catch (Exception $oException)
{
echo $oException->getMessage();
}
}
else
{
echo 'WebMail API isn\'t available';
} |
|
|
I've even tried to point the CApi::Location to index.php inside mail.domain1.com but to no success. In an older script, I saw that it was pointed to a webmail.php script.
If I revert back to CApi::Location('../'), there are no errors, but nothing is launched.
What am I doing wrong?
|
Back to Top |
|
|
iSofia Newbie
Joined: 24 May 2014 Location: Singapore
Online Status: Offline Posts: 35
|
Posted: 01 June 2014 at 5:02am | IP Logged
|
|
|
I managed to resolve the issue by placing the above login script in the WebMail folder itself, and calling it from the other subdomains through a custom login script, communicating through a cURL broker.
The email ID and password are sent through AJAX via the cURL script, and using the CURLOPT_RETURNTRANSFER option, even the error messages can be received and displayed by the custom login script.
|
Back to Top |
|
|