Can anybody tell me how to use mstor to read mbox mail messages on windows
Thanks in advance...
An example url for accessing an mstor mailbox might be:
mstor:c:/mail on a Microsoft Windows machine
Reading messages from a local store:
Session session = Session.getDefaultInstance(new Properties());
Store store = session.getStore(new URLName("mstor:c:/mailbox/MyStore"));
store.connect();
// read messages from Inbox..
Folder inbox = store.getDefaultFolder().getFolder("Inbox");
inbox.open(Folder.READ_ONLY);
Message[] messages = inbox.getMessages();
//Remember to add the properties in above code.
this.properties = new Properties();
this.properties.setProperty("mail.store.protocol", "mstor");
this.properties.setProperty("mstor.mbox.metadataStrategy", "none");
this.properties.setProperty("mstor.mbox.cacheBuffers", "disabled");
this.properties.setProperty("mstor.mbox.bufferStrategy", "mapped");
this.properties.setProperty("mstor.metadata", "disabled");
this.properties.setProperty("mstor.mozillaCompatibility", "enbled")
Related
Can someone please help me to get/read the port number, hostname, channel details when i using ccdt.tab file. these details were configured in tab file. queue creation was opened successfully by using tab file but i want to get above details (connection details) using java.
I can able to get only queue manager name and queue name by using MQQueueSender.getstringproperty(); but other not able to find.
I expect port number, hostname, channel which i defined in TAB file
MQQueueConnection connection = null;
MQQueueSession session = null;
MQQueueSender sender = null;
MQQueueReceiver receiver = null;
HashMap<String, String> setValue = null;
try {
connection = getConnection(prop.getProperty("tabFilePath"));
session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
MQQueue sendQueue = (MQQueue) session.createQueue(prop.getProperty("queueName"));
sender = (MQQueueSender) session.createSender(sendQueue); System.out.println(sender.getStringProperty("XMSC_WMQ_RESOLVED_QUEUE_MANAGER"));
System.out.println(sender.getStringProperty("XMSC_WMQ_QUEUE_MANAGER"));
There is no MQ API or Class that will parse a CCDT file for an MQ application.
Set the environment variables MQCHLLIB and MQCHLTAB to point to where your CCDT file located and then use runmqsc with the '-n' parameter to have MQ manage it then issue the following MQSC command:
DIS CHL(*) ALL
Now you will have all of the details of all CLNTCONN channels from the CCDT file.
Everything works, including authentication, but when I get to the step of creating a folder the program crashes.
I've tried switching to SMTP, didn't work, not even sure what SMTP is,
I've Tried a different Gmail account,
I've tried removing the line properties.put("mail.pop3.starttls.enable", "true"), and
I've tried removing the 3's from pop3 and pop3s.
private static void createProperties() {
// Create properties field.
Properties properties = new Properties();
properties.put("mail.pop3.host", host);
properties.put("mail.store.protocol", "pop3s");
properties.put("mail.pop3.port", "995");
//properties.put("mail.pop3.starttls.enable", "true");
emailSession = Session.getDefaultInstance(properties, null);
}
private static void createStore() throws MessagingException {
// Create the POP3 store object and connect with the POP server.
Store store = emailSession.getStore("pop3s");
store.connect(host, user, password);
}
private static void createFolder() throws MessagingException {
// Create the folder object and open it.
Folder emailFolder = store.getFolder("INBOX"); // Error here
emailFolder.open(Folder.READ_ONLY);
}
I expected to get some nicely formatted email messages.
I got the following errors:
DEBUG POP3: server doesn't support TOP, disabling it
Exception in thread "main" java.lang.NullPointerException
at GetMail.createFolder(GetMail.java:60)
at GetMail.main(GetMail.java:33)```
The POP3 protocol only supports one folder - Inbox. Use IMAP instead.
I am using JavaMail 1.5.1 and i want to do a UID SEARCH. Is this supported or do i have to issue a low level IMAP command via ((IMAPFolder) folder).doCommand(...)?
((UIDFolder)folder).getMessageByUID(uid)
According with the docs, this is the way:
Folder f = store.getFolder("INBOX");
UIDFolder uf = (UIDFolder)f;
Message msg = uf.getMessageByUID(uid);
You can find more here: https://javamail.java.net/nonav/docs/api/javax/mail/UIDFolder.html
Using Java I want to access certain Outlook public folders. I tried below code
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props);
session.setDebug(true);
Store store = session.getStore("imap");
store.connect("imap4.<something>.com", "<my user id>", "<my password>");
Folder folder = store.getFolder("Public Folders/");
folder.open(Folder.READ_ONLY);
Message[] messages = folder.getMessages();
if(messages.length == 0){
System.out.println("no message");
}
for(Message message : messages){
System.out.println(message.getSubject());
}
I have tried different combinations for "Public Folders". Every time I get:
Exception in thread "main" javax.mail.FolderNotFoundException: Public Folders/ not found
at com.sun.mail.imap.IMAPFolder.checkExists(IMAPFolder.java:302)
at com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:885)
at MailReader.main(MailReader.java:23)
Please let me know if there is any way to access Outlook public folders.
The way I used in one of my projects was EWS Java API. Here's a link to some tutorial: http://blogs.msdn.com/b/exchangedev/archive/2013/01/03/ews-java-api-1-2-get-started.aspx It's not the easiest thing I've ever done though.
Looks like Microsoft removed the ability to access public folders through the IMAP protocol in Exchange 2007 and they have no plans to restore it.
I am new to Notes JAVA API and developing a utility where I require to read all unread mails from a Lotus notes id.Now when i try to use lotus.domino.Database.getAllUnreadDocuments() it gives me the following exception
NotesException: Not implemented
at lotus.domino.cso.Base.notImplemented(Unknown Source)
at lotus.domino.cso.Document.markRead(Unknown Source)
at com.email.ReadEmailRemotely.readEmails(ReadEmailRemotely.java:428)
at com.email.ReadEmailRemotely.run(ReadEmailRemotely.java:96)
at java.lang.Thread.run(Unknown Source)
My application is a plain JAVA application in eclipse using NCSO.jar
My question is , do i need to extend lotus.domino.AgentBase ?
If yes then what all dependencies do i require as , JAVA app is not allowing to extend it.
& if no then is there any other way to get all unread mails?
An easy way (assuming you are can edit the NSF) is to create a hidden view which lists only the documents you want to get back.
Then access that view and iterate through it.
If the server supports IMAP or POP3, you can use JavaMail API, which is pretty easy and has a flag for unread messages.
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
try {
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("imaps");
store.connect("myserver.com", "user", "pass");
Folder inbox = store.getFolder("Inbox");
inbox.open(Folder.READ_ONLY);
FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
Message messages[] = inbox.search(ft);
}
You will have to switch to using notes.jar instead of ncso.jar.
In order to use notes.jar and access the getAllUnreadDocuments method, you will need to install Notes and Domino 8 or above on the system where your code is running.
May require Secure Connection(SSL), Use the following properties to connect mail server supporting POP3 protocol:
properties.put("mail.pop3.socketFactory.port", "POP3_PORT");
properties.put("mail.pop3.host", "POP3_SERVER_HOST_NAME_OR_IP");
properties.put("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.put("mail.pop3.socketFactory.fallback", "false");