dcsimg
Problem to retrive user's mail from qmail inbox
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tedros_Girmay
Posted On:   Saturday, February 3, 2007 09:05 AM

Hi, I am using qmail mail server and JavaMail API to send and read mails from user's mail box(INBOX). The code to retrive the mail for user is given below: public void checkInbox(int mode)throws MessagingException, IOException { String url = "maildir:////home/userid123/Maildir"; if (mode == 0) return; boolean show = (mode & SHOW_MESSAGES) > 0; String action = (show ? "Show" : ""); System.out.println(action + " INBOX for " + from); Store store = session.getStore(new URLName(url));    More>>

Hi,
I am using qmail mail server and JavaMail API to send and read mails from user's mail box(INBOX).

The code to retrive the mail for user is given below:

public void checkInbox(int mode)throws MessagingException,

IOException
{


String url = "maildir:////home/userid123/Maildir";




if (mode == 0) return;


boolean show = (mode & SHOW_MESSAGES) > 0;


String action =


(show ? "Show" : "");


System.out.println(action + " INBOX for " + from);





Store store = session.getStore(new URLName(url));






try {


store.connect();


Folder root = store.getDefaultFolder();



Folder inbox = root.getFolder("INBOX");



inbox.open(Folder.READ_WRITE);





if(inbox.isOpen())


System.out.println("Folder is open");


else
System.out.println("Folder is not open");



Message[] msgs = inbox.getMessages();







if (msgs.length == 0 && show)


{


System.out.println("No messages in inbox");


return;


}else{



System.out.println("Total messages in inbox" + msgs.length);
}



inbox.close(true);


store.close();






} catch (MessagingException me) {


me.printStackTrace();


}



}




if i run this code i am getting the following errors:



javax.mail.FolderNotFoundException: folder 'INBOX' not found


at net.ukrpost.storage.maildir.MaildirFolder.open(MaildirFolder.java:651)

Any suggessions?
Thanks in advance.

   <<Less

Re: Problem to retrive user's mail from qmail inbox

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, February 4, 2007 05:06 PM

Unless something has changed in recent years, "qmail" is just an SMTP server, like Sendmail -- it has no mail store itself, no mailboxes, no POP, no IMAP.
About | Sitemap | Contact