Author |
|
thbthb Newbie
Joined: 31 October 2011 Location: Norway
Online Status: Offline Posts: 3
|
Posted: 01 November 2011 at 2:01am | IP Logged
|
|
|
Hi,
I just set up hmailserver and I'm trying to get the autologon via API to work. I am able to login manually, but the programmatically way does not work.
I'm transfered to webmail/index.php?error=2 after script load.
If I am already logged in and run the script, it works perfectly.
This is my script:
include_once WM_ROOTPATH.'libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid())
{
// data for logging into account
$sEmail = 'test@domain';
$sPassword = 'password';
// Getting required API class
$oApiWebMailManager = CApi::Manager('webmail');
// attempting to obtain object for account we're trying to log into
$oAccount = $oApiWebMailManager->LoginToAccount($sEmail, $sPassword);
if ($oAccount)
{
// populating session data from the account
$oAccount->FillSession();
// redirecting to WebMail
$oApiWebMailManager->JumpToWebMail('webmail.php?check=1');
}
else
{
// login error
echo $oApiWebMailManager->GetLastErrorMessage();
}
}
else
{
echo 'WebMail API not allowed';
}
According to the debug log in both cases the login to the IMAP is successful.
Why am I unable to log in?
thanks
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 01 November 2011 at 3:19am | IP Logged
|
|
|
Is the script located in WebMail directory? If not, you'll need to supply proper URL for webmail.php in JumpToWebMail method call.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
thbthb Newbie
Joined: 31 October 2011 Location: Norway
Online Status: Offline Posts: 3
|
Posted: 01 November 2011 at 1:00pm | IP Logged
|
|
|
Hi,
The script is in the same directory as webmail.php. webmail.php is loaded, but the error The account doesn't exist, perhaps, it has just been deleted. is shown.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 02 November 2011 at 12:58am | IP Logged
|
|
|
Looks like something related to cookies or session, or maybe account authentication details. If you manage to find what's causing this, feel free to share your experience.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|