How to retrieve mails from a Mail Server ? PLEASE REPLY IF YOU KNOW !

Hello,
I am trying to retrieve mail from a mail server using the example from JGuru. The command line is as follows:
java GetMessageExample mail.wlfdle1.on.home.com (Mail Server Name) <username> <password>
I should be prompted to read the messages in your INBOX. Enter YES to see the message content.
0: [email protected] Thanks.
Do you want to read message? [YES to read/QUIT to end]
YES
Blah Blah Blah
1: [email protected] No Thanks.
Do you want to read message? [YES to read/QUIT to end]
YES
Blah Blah Blah Blah
I do not get any error or any output.
Any Clue or any idea how I can get some result ??
Response will be appreciated.
Thanks.

This is the sample program from jguru. After executing the following command (replacing the mail server, username, and password):
java GetMessageExample POP.Server username password
You'll be prompted to read the messages in your INBOX. Enter YES to see the message content.
0: [email protected] Thanks.
Do you want to read message? [YES to read/QUIT to end]
YES
Blah Blah Blah
1: [email protected] No Thanks.
Do you want to read message? [YES to read/QUIT to end]
YES
Blah Blah Blah Blah
import java.io.*;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class GetMessageExample {
public static void main (String args[]) throws Exception {
String host = args[0];
String username = args[1];
String password = args[2];
// Create empty properties
Properties props = new Properties();
// Get session
Session session = Session.getDefaultInstance(props, null);
// Get the store
Store store = session.getStore("pop3");
// Connect to store
store.connect(host, username, password);
// Get folder
Folder folder = store.getFolder("Inbox");
// Open read-only
folder.open(Folder.READ_ONLY);
BufferedReader reader = new BufferedReader (
new InputStreamReader(System.in));
// Get directory
Message message[] = folder.getMessages();
System.out.println(folder.getMessages());
for (int i=0, n=message.length; i<n; i++) {
// Display from field and subject
System.out.println(i + ": " + message.getFrom()[0]
+ "\t" + message[i].getSubject());
System.out.println("Do you want to read message? [YES to read/QUIT to end]");
String line = reader.readLine();
if ("YES".equals(line)) {
// Display message content
System.out.println(message[i].getContent());
} else if ("QUIT".equals(line)) {
break;
// Close connection
folder.close(false);
store.close();
Please help me on this.
thanks.

Similar Messages

  • I bought 2nd hand iPhone and was linked with previous owner. I want to contact him but i didn't get any address of him. How can iget his/her email address using that iphone IMEI or you know any idea... Please reply if you know solution .....

    I bought 2nd hand iPhone and was linked with previous owner. I want to contact him but i didn't get any address of him. How can iget his/her email address using that iphone IMEI or you know any idea... Please reply if you know solution .....

    There is no solution here and you should already have known this as you replied to a thread all about this a few up from your own post and this stated the postition quite clearly and the question was answered.
    Why do you ask the same question again?  The first answer is not going to change just because you don't like it!!

  • How do I move mail from an old server to a new server?

    I am rebuilding my server. The new server runs on OS X 10.9.4 with Server 3.1.2. The old server ran OS X 10.9.x and Server 3.x (the exact versions are not known).
    Within the folder /Library/Server/Mail, I found the email stores for both systems.  I have gone through each folder and identified the 36 character string that serves to identify the user's mailbox and paired each one to a user id on both systems.  On the old system, there are multiple mailboxes for some users, and I think it is a result of the users being deleted and recreated: perhaps the system identified the identical name and assumed that the user might be different and therefore created a unique 36 character id for the mail system.
    The trick is, I am trying to recover the mail from the old server.
    I have attempted to copy the files which are human readable and formatted for SMTP transmission to the new server under the correct mailbox corresponding to the owning user (see screen shots below). The simple act of copying the files has not made these files visible via the IMAP protocol. I have tried restarting the mail service hoping that the Server app would rebuild whatever indexes need to be built so that the mail can be served via IMAP, and that has not worked either.
    The question is, how do I get the mail from the old server mail boxes into the new server mailboxes?
    This screen shot shows the location of one mail collection at /Library/Server/Mail/Data/mail/[userid].  Mail sits in the "new" folder only for a moment before being processed and put into the "cur" folder.  Copying mail from the old server into the "new" folder produces an empty "new" folder, but one can see the files populate briefly before they are moved into the "cur" folder.
    The next screen shot shows one email opened in TextEdit.  The format should look very familiar.  This is the same format that one would use to send SMTP requests to an SMTP server.  This particular example happens to be an email from a Gmail account to the PediatricHeartCenter.org domain to test the mail system when the old server was set up.  It was sent on 24 Jan 2014 and had text reading "Intended for Mavericks1. -Jared".

    On further research, I have learned that OS X Server sets Dovecot to use the MailDir format.  The email messages can be removed from the folders and put back, and as long as they were present in the folder to begin with (received by Dovecot originally), they reflect in the Mail.app on client computers.  Deleting a file in the "cur" folder causes the file to disappear in Mail.app. Copying the file back into the "cur" folder will cause the file to reappear without any modification of an index file or any other system component, as long as the file was properly formatted by Dovecot to be identifiable to that folder.
    According to Dovecot.org's review of MailDir found here (http://wiki2.dovecot.org/Ma,ilboxFormat/Maildir), the file name can be broken into simple pieces: " [unixtimestamp].[process id].[hostName],S=<message size>,W=<virtual message size>/2,[status tags]".  The original MailDir++ specification requires the string ":2," to appear after the virtual size, but this file naming format is not legal in Mac OS X, so Dovecot is modified by Apple to use "/2," instead.
    The Dovecot's wiki describes inserting new messages as follows:
    Mail delivery
    Qmail's how a message is delivered page suggests to deliver the mail like this:
    Create a unique filename (only "time.pid.host" here, later Maildir spec has been updated to allow more uniqueness identifiers)
    Do stat(tmp/<filename>). If the stat() found a file, wait 2 seconds and go back to step 1.
    Create and write the message to the tmp/<filename>.
    link() it into new/ directory. Although not mentioned here, the link() could again fail if the mail existed in new/ dir. In that case you should probably go back to step 1.
    All this trouble is rather pointless. Only the first step is what really guarantees that the mails won't get overwritten, the rest just sounds nice. Even though they might catch a problem once in a while, they give no guaranteed protection and will just as easily pass duplicate filenames through and overwrite existing mails.
    Step 2 is pointless because there's a race condition between steps 2 and 3. PID/host combination by itself should already guarantee that it never finds such a file. If it does, something's broken and the stat() check won't help since another process might be doing the same thing at the same time, and you end up writing to the same file in tmp/, causing the mail to get corrupted.
    In step 4 the link() would fail if an identical file already existed in the maildir, right? Wrong. The file may already have been moved to cur/ directory, and since it may contain any number of flags by then you can't check with a simple stat() anymore if it exists or not.
    Step 2 was pointed out to be useful if clock had moved backwards. However again this doesn't give any actual safety guarantees, because an identical base filename could already exist in cur/. Besides if the system was just rebooted, the file in tmp/ could probably be even overwritten safely (assuming it wasn't already link()ed to new/).
    So really, all that's important in not getting mails overwritten in your maildir is the step 1: Always create filenames that are guaranteed to be unique. Forget about the 2 second waits and such that the Qmail's man page talks about.
    The process described by the QMail man page referenced above suggests that as long as a file is placed in the "new" folder, that a mail reader can access it.  The mail reader then moves the file to the "cur" folder and "cleans up" the "new" folder.  This is clearly happening in OS X, because the messages are moving from "new" to "cur", but IMAP is still not serving these foreign messages to the remote readers.
    The thought crossed my mind that perhaps it is the fact that the host name does not match, which would cause the failure, however changing the "host" portion of the name from the old-server to the new-server did not fix the issue.  Even with the new server name in the file name, the inserted message fails to appear in client Mail applications.
    Within the file their is header information that still references the old machine. I'd like to not have to change the email files, because this will violate the integrity of the message. Also, this might take a lot of time or incur risks associated with poor automated processing. The header information should not be referenced by Dovecot, because the wiki page describing MailDir notes that neither Dovecot nor Dovecot's implementation of IMAP refers to the messages header information when moving and serving these mail files.
    Unlike when using mbox as mailbox format, where mail headers (for example Status, X-UID, etc.) are used to determine and store meta-data, the mail headers within maildir files are (usually) notused for this purpose by dovecot; neither when mails are created/moved/etc. via IMAP nor when maildirs are placed (e.g. copied or moved in the filesystem) in a mail location (and then "imported" by dovecot). Therefore, it is (usually) not necessary, to strip any such mail headers at the MTA, MDA or LDA (as it is recommended with mbox).
    This paragraph leads me to believe that after the mail box is identified that the content of the file becomes irrelevant to the system which manages. This suggests that we should be able to inject messages into a mailbox and have the system serve them as though they had belonged in that mailbox all along. Yet I have not found a way to do this.

  • HT2500 how do i get my mail from the pop server to my inbox

    Can someone please help me ! I'm sure I did something by accident and don't know how to fix it. My problem is i don't see any emails in my inbox, however my account info says there is mail on the pop server. how do i get the mail from the pop server to my inbox?
    thank you for helping

    First try rebuilding your Inbox.
    Select the Inbox.
    Under Mailbox in the Menu bar select Rebuild (last option in list)
    Note: If you delete a POP account in Mail, it will delete any messages in the Inbox. It does not delete your custom folders or your sent messages.
    If the messages have been deleted and are no longer on the server, you can restore from Time Machine.
    Let us know if this helps.

  • I deleted an e-mail from my iCloud account from my iPhone and cleared the trash. I accidentally deleted an e-mail from my college containing a string of 3 e-mails which are very important. Is there anyway to retrieve the e-mail from the Apple server?

    I deleted an e-mail from my iCloud account from my iPhone and cleared the trash. I accidentally deleted an e-mail from my college containing a string of 3 e-mails which are very important. Is there anyway to retrieve the e-mail from the Apple server?

    My question is similar:  I deleted email folders in my mail app on iPhone 4 and it deleted the folders on all my other devices--literally THOUSANDS of emails!  I went to iCloud to recover them and can't find them.  HELP PLEASE!

  • How do we transfer contacts and mails from apple mail and address book to Microsoft outlook on my mac

    How do we transfer contacts and mails from apple mail and address book to Microsoft outlook on my mac

    From Contacts, anyway (the new version of Address Book) you can export to a .abbu file and import then into Outlook. I'm not sure about Mail as I only really use Outlook...
    Clinton

  • TS3276 how to recall email from apple mail.5

    how to recall email from apple mail.5

    We can't even if we are in a big entreprise using exchange?
    "We use Mail of Apple with the exchanche include in every mac"

  • How can i send mails from mac mail to a PC?

    When i send mails from my mac to a Pc (outlook) the mail arrive with a different format or including the mail as an atached document.
    How can i send mails from mac mail to a PC outlook with the same format?

    send it in "windows friendly format" when you click the paper clip for an attachment.

  • How to transfer mails from mac mail to outlook?

    Can anyone explain to me how to transfer e-mails from Mac Mail to Microsoft Outlook?

    I just went the other way - Outlook to Thunderbird to Mac Mail.  I lost some notes in some folders.
    My fall back position was to set up an IMAP account and use Google sync to Outlook to move my mail into a Google account.  Then on the Mac I set up a IMAP account to download all the mail.  Once I had it on the Mac, I copied the IMAP folders into Personal folders on Local Machine.  I then deleted the IMAP account and reverted to using my 'usual accounts'.
    Hope this helps you a bit!

  • Outbound mails from SAP CRM server

    Hi,
    Is there any way by which Outbound mails from SAP CRM server can be routed to more than one mail servers?
    Any suggestions or work arounds will be appreciated.
    Thanks and regards,
    Asheesh

    Hello Asheesh,
    it is possible to create more than one Mail Node in Transaction SCOT. The mail can then be routed depending on the Domain Name.
    Regards
    Gregor

  • How to poll emails from a SMTP server

    Hi, It seems all the examples I found were to construct/send emails to SMTP server. How to build a module to retrieve emails from a SMTP server and then extract the info? I checked the javax.mail.Transport
    class and could not find method such as getMail or getMessage. Thanks,

    Close but so far... ;)
    You'll want to check out the rest of the [url http://java.sun.com/products/javamail/javadocs/index.html] JavaMail API classes . In particular take a look at the Store and Folder classes.
    One last thing - here's a really good [url http://java.sun.com/developer/onlineTraining/JavaMail/] tutorial  that may help.
    &#8734; brewman &#8734;

  • Suddenly can not access .mac mail from Apple Mail

    Suddenly, I can not access .mac mail from Apple Mail (Version 2.1.1 (752.3)).
    For quite a few years I have been using Apple Mail to access my .mac email. As of last Friday, Mail stopped working. Nothing has changed (accept for the installation of the latest OS X security upgrade - SecUpd2006-008Univ.pkg).
    I can still access my .mac mail through the .mac web browser and I can still access it through SnapperMail on my Palm Treo 680. But, when I open Apple Mail on my MacBook, it does not do anything, just sits there. When I open the Activity Viewer window, 3 activities are going on:
    1. Opening Mailbox
    2. Synchronizing with Server (Connecting to...)
    3. Synchronizing with Server (Synchronizing with...)
    After a few minutes, the error triangle appears next to the Inbox and .Mac logos on the left hand panel.
    I have tried Apple Mail from several locations (different ISP / WiFi / LAN) over several days but get the same problem.
    Does anyone have ideas for a solution?
    Regards
    Peter

    Let’s first make sure that the update is installed properly, and post back with your observations when done.
    Verify/repair the startup disk (not just permissions), as described here:
    The Repair functions of Disk Utility: what's it all about?
    After having fixed all filesystem issues, if any, reinstall the update that appears to not have been installed properly. You may also need to reinstall the Combo Update for the type of computer and the version of Mac OS X you’re using, unless this is the version of Mac OS X that came with your computer:
    About the Mac OS X 10.4.8 Combo Update
    Mac OS X 10.4.8 Combo Update for PPC
    Mac OS X 10.4.8 Combo Update for Intel
    Take a look at the following articles for guidelines on how to properly install system updates:
    Troubleshooting installation and software updates
    Installing software updates
    Basically, you should verify/repair the startup disk before installing the update, no applications should be running while installing it, and you may experience unexpected results if you have third-party system software modifications (not normal applications) installed.

  • Cannot send mail from mac mail or Entourage

    Hi guys,
    Wondered if anyone out there can shed some light on this little problem.
    I use Entourage for my emails & all was working fine until yesterday. I can receive mail from all and sundry but I can't send anything. I subscribe to ntlworld internet service and if log onto my email through their webmail, then it's fine. I've tried sending mail from mac mail and I get the same problem. I've been onto microsoft support & gone through all the troubleshooting with Entourage. The Entourage techy suggested it was my internet provider blocking my emails as they think I'm a spammer?? I phoned ntl & they insist it's nothing to do with them as I can send/receive from the website. (If I send an email with the address @ntlworld it's fine, but any other address i.e. all my clients/mates etc just stays in my outbox.
    Nothing on any of my settings has changed so I'm at a loss what to do next.
    Any suggestions greatly appreciated.
    Thanks, Mel

    it may be that your server (internet provider) has just started blocking outgoing mails not authenticated by them.
    Go to your account set up...
    and fill in the following details.
    SMTP SERVER: smtp.mac.com
    then click on advanced sending otions...
    click on override default SMTP port... type 587
    click on SMTP servber requires authentication...
    use same setting as receiving mail server.
    try this...

  • How to retrieve data from a MSSQL?

    Dear All,
    How can I retrieve data from a MSSQL server in my custom iView which is developed by Eclipse?
    Thanks
    Sam

    Hi Sam,
    you have a bunch of possibilities... (and they do not really differ from accessing a DB from within any J2EE app).
    You can use a direct connection, setting Database, port, user, ... within your component.
    Or you can set all these things within VisualAdmin and then reference the DataSource via JNDI from within your component.
    You can directly use SQL.
    Or you can use ObjectRelationalMappers like Hibernate...
    Any more questions?
    Hope it helps
    Detlev

  • EVDRE encountered an error retrieving data from the Web Server

    Hi,
    I'm working on a presales AppSet "Demo5b".
    When I create a brand-new EVDRE report on FINANCE app, there is no problem.
    However, after changing to ICMATCHING app, when I type =EVDRE() on a blank sheet and press Refresh, the following message pops up.
    EVDRE encountered an error retrieving data from the Web Server
    Retrying in (??) seconds
    Any idea why this happens and how it can be solved?
    Thanks!
    Sunny

    Hi Joost,
    I have the same problem. When I try to retrieve data on an input schedule is launched that error.
    I am working on an VM on MS BPC.
    I am not working with cubes so the solution is not the same.
    If i process all my dimensions this error does not appear any more?
    Best regards,
    Vitor

Maybe you are looking for

  • I have a 13 inch macbook (late 2007) what is the maximum allowable height for a hard drive?

    what is the maximum allowable height for an internal hard drive. I want to replace my hard drive are there any other things I should make sure of in terms of compatability?

  • Firefox is not displaying some fonts

    Since I upgraded my mac to the new imac and to OS 10.6 I have been having problems with fonts on Firefox. Most of them do not display. In fact, I am sending this message on Safari because Firefox only showed the login, not the ask new question page.

  • My speakers won't turn on.

    My output speakers won't turn on, every time I attempt to raise or lower the sound, the sound icon pops up and says it is at full volume. But then below the sound bar is a little white circle with a cross through it. But every time I plug in my headp

  • Convert picture from word document to .jpg

    I'd like to know how to copy a picture from a word document and convert it to a .jpg format so I can use iphoto or other image software to edit and print it.  I tried a work-around that's not very satisfactory, that is to print the picture on photo p

  • TS4083 MobileMe emails stopped pushing to iPhone and ipad

    my mobile me emails stopped pushing to my phone and ipad two days ago. I can only retrieve them when I open the account and tell it to look for mail.