Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Pro

 AfterLogic Forum : AfterLogic WebMail Pro
Subject Topic: External link to the message read screen Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
rob
Groupie
Groupie


Joined: 03 September 2008
Location: Canada
Online Status: Offline
Posts: 60
Posted: 14 November 2008 at 4:01pm | IP Logged Quote rob

Hope you can guide me in the right direction here.

We are querying the database to generate a summary of new emails that we display on our applications dashboard for our clients and need to create hyperlinks for each message that will direct the user to the read message screen within mailbee which i have an active logged in session within another div screen.

For example:
Consider that we have 2 div screens, 1 holds our dashboard content, and the other hold the mailbee application with the current user already logged in using the integr.php features. By showing and hiding the divs we can quickly flip between the two screens without having to reload the whole mailbee application each time.

So on our dashboard screen when we create a list of new messages i have access to the following database values for each message:

awm_messages.id_acct
awm_messages.id
awm_messages.id_msg

as well as another others if needed. How can i structure a link that will instruct the mailbee application to show the specified message in the read screen? IE: same screen shown after double-clicking a message in the message list window.

I will take care of the displaying of the appropriate div screen on our end, i just need to know the ajax call (or equiv.) that will get mailbee to show me the proper message.

Hope this makes sense.

Rob
Back to Top View rob's Profile Search for other posts by rob
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6092
Posted: 17 November 2008 at 2:09am | IP Logged Quote Igor

Try calling the following function, it should send AJAX request if WebMail is already loaded:

Code:
SetHistoryHandler(
        {
              ScreenId: SCREEN_VIEW_MESSAGE,
              FromDrafts: false,
              MsgId: msg.Id,//awm_messages.id_msg
              MsgUid: msg.Uid,//awm_messages.int_uid for IMAP, awm_messages.str_uid for POP3
              MsgFolderId: msg.FolderId,//awm_messages.id_folder_db
              MsgFolderFullName:  msg.FolderFullName,//awm_folders.full_path
              MsgCharset: msg.Charset,//awm_messages.charset
              MsgParts: [PART_MESSAGE_HEADERS, PART_MESSAGE_HTML, PART_MESSAGE_ATTACHMENTS]
        }
   );


Please let us know if this helps you. Thanks!

Regard,
Igor
Back to Top View Igor's Profile Search for other posts by Igor
 
rob
Groupie
Groupie


Joined: 03 September 2008
Location: Canada
Online Status: Offline
Posts: 60
Posted: 17 November 2008 at 4:12pm | IP Logged Quote rob

Hi Igor,

I think i have it working as planned. If i run into problems, I'll get back to you.

Thanks for the help.
Back to Top View rob's Profile Search for other posts by rob
 
rob
Groupie
Groupie


Joined: 03 September 2008
Location: Canada
Online Status: Offline
Posts: 60
Posted: 27 November 2008 at 11:44am | IP Logged Quote rob

Hi igor,

I have another question on this topic.

Can I pass a parameter along that will automatically have mailbee flip to the proper email account when trying to display a message?

For example, we have users that have multiple accounts setup (IE: mailbox1,mailbox2). If the user is currently logged into mailbee looking at mailbox1, and we provide a list of emails on our other screen that include email from their mailbox2, as soon as they follow the link mailbee reports back saying the email has been deleted from the server most likely because it is trying to display a message that is in mailbox2 while they are currently looking at mailbox1.

Ideally it would be nice to have a call that would get mailbee to change from the active mailbox1 to mailbox2 first, then the other call as above to display the message. Or a single call like above that would take care of this automatically.

One thing that would need to be assured is that the mailbox that mailbee switches to is owned by the currently logged in user.

Did this make sense?

Rob
Back to Top View rob's Profile Search for other posts by rob
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6092
Posted: 28 November 2008 at 6:10am | IP Logged Quote Igor

To implement the approach you requested, you'll need to call the function:
Code:
           SetHistoryHandler(
                {
                     ScreenId: WebMail.ListScreenId,
                     IdAcct: id
                }
           );


This would switch WebMail to the account referenced using "id" identifier. Once this is done, account identifier stored in session would be overwritten and you may use the function we provided you with previously.

Regards,
Igor
Back to Top View Igor's Profile Search for other posts by Igor
 
rob
Groupie
Groupie


Joined: 03 September 2008
Location: Canada
Online Status: Offline
Posts: 60
Posted: 04 December 2008 at 2:49pm | IP Logged Quote rob

Hi Igor,

Well we tried to do as you suggested with the first call to switch the email profile over to the other IdAcct prior to trying to display a message and are running into problems here.

With the call in place if we try to request a message from a different profile (IdAcct) mailbee appears to be switch the screen to the specified IdAcct, but then upon requesting the message an error occurs saying the message has already been deleted off the server. We have also seen another message afterwards that says "An attempt of unauthorized access to account of another user detected".

We are using the database to store all emails and the response of the message being deleted off the server already would technically be correct as we previously would have downloaded it from the mail server into the database.

Any ideas here?

Could there be a session var not set correctly or maybe a parameter that i need to pass in to authenticate that the specified IdAcct that i want displayed is owned by the currently logged in user?

Hope you can help.

Rob
Back to Top View rob's Profile Search for other posts by rob
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 05 December 2008 at 5:07am | IP Logged Quote Andrew

It seems you try to switch between accounts of different users. If this is the case (awm_accounts.id_user is different for the accounts), it wouldn't work without re-logging in. Please check this and let us know if this is the case.

Our developers followed the instructions we provided you with and the issue happens only when switching between accounts with different awm_accounts.id_user.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
rob
Groupie
Groupie


Joined: 03 September 2008
Location: Canada
Online Status: Offline
Posts: 60
Posted: 05 December 2008 at 2:56pm | IP Logged Quote rob

Hi Andrew,

No the id_user is the same for both accounts. Here is what we are doing:

SetHistoryHandler(
         {
            ScreenId: WebMail.ListScreenId,
            IdAcct: id_acct
         }
    );
                     
SetHistoryHandler(
     {
     ScreenId: SCREEN_VIEW_MESSAGE,
     FromDrafts: false,
     MsgId: id_msg,     
     MsgUid: str_uid,
     MsgFolderId: id_folder_db,
     MsgFolderFullName: folderName,     MsgCharset: charset,     
MsgParts: [PART_MESSAGE_HEADERS,PART_MESSAGE_HTML,PART_MESSAGE_ATTACHMENTS]                            
}
);

I have checked all the parameters and are they are passing is as expected.

Should there be a time delay between calls, or can they have one after another without problem.


Back to Top View rob's Profile Search for other posts by rob
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 08 December 2008 at 4:34am | IP Logged Quote Andrew

Quote:
Should there be a time delay between calls, or can they have one after another without problem.


The new account is applied not immediately, but after folder list request got to the server and the server returned the response. I.e. it's necessary to wait for that response. WebMail doesn't have a flag which would allow you to learn if the server returned the response, but you can add such flag yourself or implement a callback to your code in WebMail code which will call your procedure when the request/response is complete.

File class.webmail.js, after line ~271:

Code:
case TYPE_FOLDERS_LIST:
  if (Data.IdAcct == this._idAcct) {


Please note, this code branch works not only in the case above, but in all other cases when server returns folders list.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide