Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: How to get unread mail programmatically Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 3:17am | IP Logged Quote inform_sabya

Hello,

I am using After Logic Mail Suite Pro for both client & server.

My application requirement is, before opening webmail unread mail must be displayed for the user in our home page.

How to get the unread mail for the user from webmail. I check in webmail db in awm_messages table. But it is not helpful. So please help me how to get unread mail programmatically.


Any help in this matter will be greatly appreciated.


Thanks and Best Regards
Sabya
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 5:15am | IP Logged Quote Igor

Neither MailSuite nor WebMail provide this functionality. If you are integrating MailSuite Pro into your own web application, you
could use MailBee.NET Objects to code a little snippet which accesses the account via IMAP and gets a number of unread mails.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 5:49am | IP Logged Quote inform_sabya

Thanks for the reply.

Please if you are able to provide me C# code for downloading, very helpful for me.

Thanks
Sabya

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


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 6:07am | IP Logged Quote Igor

The following code should suffice to get the idea of this:

Code:
MailBee.ImapMail.Imap.LicenseKey = "the license key";
Imap mailer = new Imap();
mailer.Connect("mail.server.com");
mailer.Login("username","password");
FolderStatus status = mailer.GetFolderStatus("Inbox");
Console.WriteLine("New messages: " + status.UnseenCount);


--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 6:28am | IP Logged Quote Igor

Correction. With MailSuite Pro, you might need to supply auth method explicitly:

Code:
mailer.Login("username","password",AuthenticationMethods.Reg ular);


--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 6:34am | IP Logged Quote inform_sabya

Thank you so much for the details.

I have a valid license for webmail, the details are:

License Key for "AfterLogic XMail Server Pro for Windows (Single Computer, Unlimited Users)"

My order number is 297101145.

I am using the same license key but it not working.

I am installed in my local system and I connected DB from other system(192.168.1.11\SQLExpress).

I created a domain like mydomain. So what is the server name for the imap connection?
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 6:40am | IP Logged Quote Igor

As long as you use the same license key for MailSuite Pro and for MailBee.NET.dll included into it (WEBMAIL\bin directory),
the key should work just fine.

Domain to be used for IMAP connection is the same one as you created, as long as it is resolved correctly of course.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 6:56am | IP Logged Quote inform_sabya

But still I am getting below error:

Imap component not licensed. LicenseKey is invalid. See documentation on LicenseKey property of the component for more information.
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 6:58am | IP Logged Quote Igor

What's the DLL version? And do you supply the key before creating IMAP object?

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 7:03am | IP Logged Quote inform_sabya

MailBee.NET dll version is "5.6.2.149" and the license key is "*****".
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 7:22am | IP Logged Quote Igor

My bad, sorry. 4 last characters of the key hold information on licensed number
of users, that information is not intended for MailBee.NET and should be dropped.
Thus, please remove 4 last chars of the key and try again.

And please do not post your licensing information such as license key in a public
locations like this.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 7:37am | IP Logged Quote inform_sabya

Sorry for the posting full key. Thanks for "*****".

Still it is not working.
---------------------------------------------
MailBee.ImapMail.Imap.LicenseKey = "****";
Imap mailer = new Imap();
// Connect to the server, login and select inbox.
mailer.Connect("mail.ourstaffing.com");
mailer.Login("oroony@ourstaffing.com", "^WKYKX3TG66!", AuthenticationMethods.Regular);
mailer.SelectFolder("INBOX");
//FolderStatus status = mailer.GetFolderStatus("Inbox");
mailer.DownloadEntireMessages((mailer.MessageCount - 9).ToString() + ":*", false);
// Disconnect from the server.
mailer.Disconnect();
---------------------------------------------
Is it correct code?

Thanks
Sabya
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 7:45am | IP Logged Quote Igor

Quote:
Sorry for the posting full key. Thanks for "*****".


No problem. I just hope those access credentials you've posted further are not
actual ones :)

Quote:
Still it is not working.


Please explain this. It's either showing errors or just not doing what you want
it to do. Which is the case?

Quote:
Is it correct code?


Depends on what exactly you are trying to do. I thought you need a code for
determining a number of unread messages, but your code tries to do something
else. In particular, you calculate "mailer.MessageCount - 9" while MessageCount
might be less than 9, and that might cause various errors.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 20 January 2011 at 8:03am | IP Logged Quote Igor

Please note that your product maintenance has expired already. If you'd like to keep getting support and
updates from us, please contact us via HelpDesk regarding
maintenance renewal. Annual renewal fee is 50% of the initial license cost.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 20 January 2011 at 8:54am | IP Logged Quote inform_sabya

MailBee.ImapMail.Imap.LicenseKey = "****";

This line itself I am getting error. The error is "Imap component not licensed. LicenseKey is invalid. See documentation on LicenseKey property of the component for more information."
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 21 January 2011 at 12:11am | IP Logged Quote Igor

The key you supply should end with 6E-41FE, please recheck this.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 27 January 2011 at 4:14am | IP Logged Quote inform_sabya

Hello Igor,

Thanks, Sorry for the delay reply.

I am getting message count, but my requirement is displaying messages in my home
page. So I need to insert in db table. like clicking on the "check Mail"
functionality in webmail.

My Code:
========
string webMailProPath = ConfigurationManager.AppSettings["WebMailProPath"];
             string webMailProURL =
ConfigurationManager.AppSettings["WebMailProURL"];
             Integration integration = new Integration(webMailProPath,
webMailProURL);

             //Getting web mail password from DB
             ISM.DRM.Common.User _theUser = new ISM.DRM.Common.User();
             string webMailPassword =
Convert.ToString(_theUser.GetWebMailPassword(DRMSession.User .UserID));

             WebmailSettings settings = (new
WebMailSettingsCreator()).CreateWebMailSettings();
             MailBee.ImapMail.Imap.LicenseKey = (settings.LicenseKey.Length >=
39) ? settings.LicenseKey.Substring(0, 39) : settings.LicenseKey;

             if
(integration.UserExists(Convert.ToString(DRMSession.User.Int ernalEmail),
Convert.ToString(DRMSession.User.InternalEmail), webMailPassword))
             {
                // Check webmail password is active or not
                if (!String.IsNullOrEmpty(webMailPassword))
                {
                     Imap mailer = new Imap();
                     //Connect to the server, login and select inbox.
                     
mailer.Connect(Convert.ToString(ConfigurationManager.AppSett ings["IncomingIMAP"]
));
                     
mailer.Login(Convert.ToString(DRMSession.User.InternalEmail) , webMailPassword,
AuthenticationMethods.Regular);
                     mailer.SelectFolder("INBOX");
                     //Download the latest messages.
                      if (mailer.MessageCount > 0)
                      {
                          
mailer.DownloadEntireMessages(mailer.MessageCount.ToString() + ":*", false);
                     }
                     //Disconnect from the server.
                     mailer.Disconnect();
                }
             }



Thanks and Best Regards
Sabya
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 27 January 2011 at 4:47am | IP Logged Quote Igor

So, what exactly is your question? Did you perform step-by-step troubleshotting
of this, to find out which part of the code fails?

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 27 January 2011 at 5:05am | IP Logged Quote inform_sabya

Thanks for the quick reply.

This code is working fine, and giving me the count of new unread mails.

But my requirement is 'How to get unread message body and subject, since all the
messages are in queue'.

OR

How to insert unread message details in table("awm_messages"), since all the
messages are in queue.


Thanks
Sabya
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 27 January 2011 at 5:17am | IP Logged Quote Igor

I don't see why would you ever need to deal with WebMail Pro database. As long as we are speaking of
accounts hosted by MailSuite Pro, relying on database makes little to no sense, particularly since
message body is not stored there. I still believe using code powered by MailBee.NET Objects would
allow you to reach max code efficiency. Basically, if you can log into account via IMAP, you can
search for unread messages and obtain any details about them:
subject, plain/html body text etc.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 27 January 2011 at 5:57am | IP Logged Quote inform_sabya

Hi Igor,

Let me make my requirement a bit more clear.

I have to show number of new mails, number of unread mandatory mails along with
it's subject and body, in my application's home page.

I am able to get the number of unread new mails. But I am facing difficulty to
get the number of mandatory mails and body of mail.

I had gone through the Select function which you provided in your previos post,
but couldn't find anything helpful.

Thanks
Sabya
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 28 January 2011 at 4:21am | IP Logged Quote inform_sabya

Hello Igor,

I am waiting for your help. Could you please help me regarding above post forum.

Thanks and Best Regards

Sabya
Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 28 January 2011 at 4:26am | IP Logged Quote Igor

If you put it this way, how about renewing product maintenance?

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 04 February 2011 at 2:49am | IP Logged Quote inform_sabya

Igor,

The Product maintenance has been renewed. Following are the details
AfterLogic Annual Product Maintenance (#300385162)
Order REF# 364629595


Now I would like some response from you on the problem that i had stated in the
above post (date: 27 January 2011 at 10:57am).

Thanks,
Sabya

Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 
inform_sabya
Newbie
Newbie
Avatar

Joined: 20 January 2011
Location: India
Online Status: Offline
Posts: 18
Posted: 04 February 2011 at 2:50am | IP Logged Quote inform_sabya

inform_sabya wrote:
Igor,

The Product maintenance has been renewed.

Now I would like some response from you on the problem that i had stated in the
above post (date: 27 January 2011 at 10:57am).

Thanks,
Sabya

Back to Top View inform_sabya's Profile Search for other posts by inform_sabya
 

Page of 2 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

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