Maximum retries for sending mail ( java mail api )

Hi,
How can I set the property "maximum retries for sending mail" for my smtp through java mail api ?
Is there any property that I need to set in the Javamail session or any other way out ?
Thanks.

That's a server property. You would set that in your server configuration. JavaMail is for sending and receiving mail, not for controlling mail servers.

Similar Messages

  • Keyboard shortcut for sending messages on Mail suddenly stops working

    I've created a keyboard shortcut (Command + Return) specifically for sending manssages on Mail. When I open Mail, this keyboard shortcut works perfectly but suddenly it stops working.
    If I close and reopen Mail, the keyboard shortcut starts to work again, but for a while.
    I'm using OS X 10.9.1 and Mail 7.1 (1827).

    Howdy Guilherme
    Give this a try if you haven't already.
    System Preferences
    Keyboard
    Shortcuts
    At the bottom of the left panel go to:
    App Shortcuts
    If Mail.app isn't there, add it.
    Under it add Send.
    Now choose your key combo i.e.
    ⌘↵
    Worked for me mail Version 7.1 (1827) running OS X 10.9.1.

  • Please..how to instal libero mail on mi Ipad. I need the parameter for send and receive mail..Thanks

    Please..how to instal "libero" mail on my Ipad. I need the parameter for send and receive mail..Thanks

    FYI: POP will by default, delete messages from the server after downloading them (This applies to most pop clients, computer or mobile). POP is old tech and is not recommended if IMAP or Exchange are available. The default when setting up a g-mail type account is IMAP. Full synchronization with the server. You may also be able to set it up as an Exchange account, allowing for push e-mail and sync of calendars and contacts as well. See the Gmail help pages for instructions.

  • Function Module for sending Encrypted e-mail

    Hi All,
    I am currently working for JNJ Client and Currently I have a requirement to send an E-mail with Encrypted format.
    When users receive an E-mail ,he/She should be able to open when there is only a secure Token connected to his system.
    Based on my search i could able to find there is a function module SO_DOCUMENT_SEND_API1.
    Could any on of you expalin how can we send Encrypted E-mail through this FM.
    Please Note : We are Planning to send an E-mail containing System SAP System Password if he gets unlock.
    It would be great help if you could share this valuable information.
    Regards,
    Sujatha Arsid.

    I think it is matter of setting your config correctly. Refer these 2 links which details the standard process for this: https://help.sap.com/saphelp_nw73ehp1/helpdata/en/4a/25775009071d0fe10000000a42189c/frameset.htm
    http://help.sap.com/erp2005_ehp_04/helpdata/en/6f/d02041cfb7f423e10000000a155106/content.htm

  • Read Receipt for Email using Java Mail

    hi,
    i am trying to implement requesting the read receipts for the email sent out.
    for that i got some information that by setting header "Disposition-Notification-To" and the value should be "<Destination email address>"
    should i need to make any changes in the mailing server or i can handle it in my code to save it in the database.
    can some one please guide me so that i can implement this.
    Thank You

    Hi Bshannon,
    From your response, I understand that setting Disposition-Notification does not give a complete result for the read-receipts (We do not receive notifications from all domains, I tried gmail, yahoo, and other domains as well).
    Since your reply was sent 2 years ago, I would like to know any new solution found to get a complete read-receipt  notifications from all domains?.
    Your response would be highly appreciated.
    Thanks,
    Stalin R

  • Java mail Gmail send and receive messages

    Dear All
    can any body send me java mail api TESTED code for send and receive gmail messages. There are may sample code on net are available but I am failed to find solution. Please help
    I will be very thank full to you
    regards
    Aamir

    No. This is not a free coding service. It is a user to user forum. The general idea is that you ask questions about code you have already written. If you want tested code you generally have to pay for it. Locking this thread, for later deletion.

  • Creation of transport rule to send all external mails through a particular server for a specific user..

    HI,
    In our Organisation We have a question, is there any possibility to create a transport rule for sending all external mails through a particular server by a specific user.
    in our organisation we have exchange 2007 one mailbox server and two hub transport servers...and we are using symantic gate way..

    Hi,
    Based on my knowledge, we can use the following transport rule to make that except with one user, other users cannot send outbound external emails:
    And I’m afraid that there is no Exchange feature to make one specific HUB server rout all external emails.
    Because if a Send connector is configured to send messages to an external domain, any Hub Transport server in the organization will route a message for that domain to a source server for that connector to be relayed to the destination domain.
    If you have any question, please feel free to let me know.
    Thanks,
    Angela Shi
    TechNet Community Support

  • Gmail, Java Mail -  SSL Mess

    I've read many tutorials, as well as forums, and guides. Many are outdated or just didn't cover SSL at all. I think this SSL business with Gmail appears to be farely recent.
    The most helpful guide I've found was here . The SSLNotes for the latest Java Mail.
    Here's the code:
        private void sendTxt(String[] call_info) {
            Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
            try {
                MailSSLSocketFactory sf = new MailSSLSocketFactory();
                sf.setTrustAllHosts(true);
                Properties props = System.getProperties();
                props.setProperty("mail.transport.protocol", "smtps");
                //props.setProperty("mail.host", "smtp.gmail.com");
                props.setProperty("mail.smtps.host", "smtp.gmail.com");
                props.put("mail.smtp.auth", "true");
                props.put("mail.smtp.port", "465");
                //props.put("mail.smtp.socketFactory.port", "465");
                //props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
                //props.put("mail.smtp.socketFactory.fallback", "false");
                props.put("mail.user", "[email protected]");
                props.put("mail.smtp.starttls.enable","true");
                props.put("mail.smtp.ssl.enable", "true");
                props.put("mail.smtp.ssl.checkserveridentity", "true");
                props.put("mail.smtp.ssl.socketFactory", sf);
                Session session = Session.getDefaultInstance(props, new Authenticator() {
                    @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                        return new PasswordAuthentication
                        ("[email protected]", "*****");}});
                session.setProtocolForAddress("rfc822", "smtps");
                session.setDebug(true);
                Transport transport = session.getTransport();
                MimeMessage msg = new MimeMessage(session);
                msg.setSender(new InternetAddress("[email protected]"));
                msg.setSubject("subject");
                msg.setContent("body", "content");
                msg.addRecipient(Message.RecipientType.TO,
                        new InternetAddress("[email protected]"));
                transport.connect();
                Transport.send(msg);
                transport.close();
            } catch (MessagingException me) {
                System.err.println(me.getMessage());
                me.printStackTrace();
                System.exit(0);
            } catch (GeneralSecurityException gse) {
                System.err.println(gse.getMessage());
                gse.printStackTrace();
                System.exit(0);
        }here are the error messages
    DEBUG SMTP: exception reading response: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetAny guidance or opinions are always greatly appreciated.

    bshannon, you were right, I cleaned it up. As soon as I found the MailSSLSocketFactory class,
    and I could bypass the certificate nonsense it worked. Here it is.
    public class TxtAlert {
        private final String host = "smtp.gmail.com";
        private final String from = "[email protected]";
        public TxtAlert(String[] data, String recipient) {
            try {
                  // setup mail server
                MailSSLSocketFactory sf = new MailSSLSocketFactory();
                sf.setTrustAllHosts(true);
                // set system properties
                Properties props = System.getProperties();
                props.put("mail.smtps.ssl.socketFactory", sf);
                // get session
                Session session = Session.getDefaultInstance(props);
                session.setDebug(true);
                // define message
                MimeMessage msg = new MimeMessage(session);
                msg.setFrom(new InternetAddress(from));
                msg.addRecipient(Message.RecipientType.TO,
                        new InternetAddress(recipient));
                msg.setSubject("Hello JavaMail");
                msg.setText("Welcome to JavaMail");
                // send message
                SMTPSSLTransport transport = (SMTPSSLTransport)session.getTransport("smtps");
                transport.connect(host, from, "password");
                transport.sendMessage(msg, msg.getAllRecipients());
                System.err.println("txt has been sent");
            } catch (MessagingException me) {
                System.err.println(me.getMessage() );
                System.err.println("-------------------");
                me.printStackTrace();
                System.exit(0);
            } catch (GeneralSecurityException gse) {
                System.err.println(gse.getMessage() );
                System.err.println("-------------------");
                gse.printStackTrace();
                System.exit(0);
        }

  • Apple Mail - how do you send to a mailing list of a hundred or more names?

    Apple Mail - how do you send to a large mailing list. I have tried pasting in a string of addresses to an Addressbook listing, copying that into BCC, but the program just chugs away for ever and then fails.
    Thanks

    Are you using iCloud? Here are the maximum numbers for sending emails:
    http://support.apple.com/kb/HT4863
    If you are referring to a different provider, check with them - every ISP has limits (to deter spammers mostly).

  • Size limit for sending attachments?

    Anyone know what the size limit is for sending/forwarding e-mails with attachments when using a BES?
    I am the IT administrator and all the file sizes are set to unlimited in the BES attachment manager configuration.
    A user received an email with a 4MB attachment and they are attempting to forward it and they are unable to.
    In researching this some people have said this is a RIM limitation, I haven't found any definitive answer from an official source on this though.
    I did find this FAQ: 
    http://wirelesssupport.verizon.com/faqs/PDA+Smartphone+Email/faqs.html?t=5#item12
    That says it's either 4MB or 2MB.
    But i'm not sure if they're only taking about POP or BIS accounts and not a corporate server in the mix or not.
    Any info would be appreciated.
    Thanks!

    Thank you very much.
    it is 3MB.
    this is also described here: http://docs.blackberry.com/en/admin/deliverables/12107/Change_max_file_size_for_attach_users_send_497943_11.jsp
    This is really surprising to me.
    RIM needs to upgrade their network from  late 90's standards.
    It's pretty common for people to send and receive attachments larger than 3MB these days.
    I will need to start recommending people buy android, windows mobile or iphones moving forward.

  • Maximum size for an HttpRequest? Set Content-Length?

    Hi, I'm managing to get small strings sent from my applet to my servlet, but when I try anything bigger, I get problems. Oddly enough, the larger object can get sent to my applet from my servlet without any issues.
    Can anyone tell me if there is a maximum size for sending responses?
    Or, if I have to set the content-length property in my applet before I send my data, how do I get the size of my object so I can set it?
    thanks for any advice any of you might have

    Thanks for the pointers.
    BalusC, at first I was trying to write my object without sending it through a byteStream first (hence the q) :), tried it that way too and wouldn't work.
    I finally figured out that it wasn't the code that was the problem, but it was an upload issue (server specific). Have changed the code to sending one line of data at a time since I was converting my object to an output file in the servlet anyway. Not the best solution but it works :)
    Thanks again

  • JAVA TV API Guide

    Is there any comprehensive guide available for building & running Java TV API applications?
    regards,
    kedar

    Thanks Roger :)
    I don't have as much time as I used to to post here, but I still lurk and do (eventually) answer questions that arrive in my inbox. The site will be slowly getting updated now that the move to a new hosting provider and content management system is mostly complete, so I should have more time on my hands to ad new content to the site in the coming months.
    Steve.

  • Error while sending mail when using Java Mail API

    Hi Experts,
    I am trying to execute a webdynpro application which uses the Java Mail API to send emails. The exception that I get on executing the application is :
    Sending failed;  nested exception is: javax.mail.SendFailedException: Invalid Addresses;  nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Can anybody please help me sort out the issue.
    Regards
    Abdullah

    Hi,
    Usually one get this error if the SMTP server is configured not to relay mails (a security measure) or the SMTP server need the mail to be sent from a trusted IP or with proper authentication. Some SMTP servers are configured to block junk mails.
    Pls check with your  mail server administrator.
    Regards

  • Problem in sending messages using java mail api

    Hi All,
    I have a problem in sending messages via java mail api.
    MimeMessage message = new MimeMessage(session);
    String bodyContent = "ñSunJava";
    message.setText (bodyContent,"utf-8");using the above code its not possible for me to send the attachment. if i am using the below code means special characters like ñ gets removed or changed into some other characters.
    MimeBodyPart messagePart = new MimeBodyPart();
                messagePart.setText(bodyText);
                // Set the email attachment file
                MimeBodyPart attachmentPart = new MimeBodyPart();
                FileDataSource fileDataSource = new FileDataSource("C:/sunjava.txt") {
                    public String getContentType() {
                        return "application/octet-stream";
                attachmentPart.setDataHandler(new DataHandler(fileDataSource));
                attachmentPart.setFileName(filename);
                Multipart multipart = new MimeMultipart();
                multipart.addBodyPart(messagePart);
                multipart.addBodyPart(attachmentPart);
                message.setContent(multipart);
                Transport.send(message);is there any way to send the file attachment with the body message without using MultiPart java class.

    Taken pretty much straight out of the Javamail examples the following works for me (mail read using Thunderbird)        // Define message
            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress(from));
            // Set the 'to' address
            for (int i = 0; i < to.length; i++)
                message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    // Set the 'cc' address
    for (int i = 0; i < cc.length; i++)
    message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc[i]));
    // Set the 'bcc' address
    for (int i = 0; i < bcc.length; i++)
    message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc[i]));
    message.setSubject("JavaMail With Attachment");
    // Create the message part
    BodyPart messageBodyPart = new MimeBodyPart();
    // Fill the message
    messageBodyPart.setText("Here's the file ñSunJava");
    // Create a Multipart
    Multipart multipart = new MimeMultipart();
    // Add part one
    multipart.addBodyPart(messageBodyPart);
    // Part two is attachment
    for (int count = 0; count < 5; count++)
    String filename = "hello" + count + ".txt";
    String fileContent = " ñSunJava - Now is the time for all good men to come to the aid of the party " + count + " \n";
    // Create another body part
    BodyPart attachementBodyPart = new MimeBodyPart();
    // Get the attachment
    DataSource source = new StringDataSource(fileContent, filename);
    // Set the data handler to this attachment
    attachementBodyPart.setDataHandler(new DataHandler(source));
    // Set the filename
    attachementBodyPart.setFileName(filename);
    // Add this part
    multipart.addBodyPart(attachementBodyPart);
    // Put parts in message
    message.setContent(multipart);
    // Send the message
    Transport.send(message);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Complete working code for Gmail POP3 & SMTP with SSL - Java mail API

    Finally, your code-hunt has come to an end!!!!
    I am presenting you the complete solution (with code) to send and retrieve you mails to & from GMAIL using SMTP and POP3 with SSL & Authenticaion enabled. [Even starters & newbies like me, can easy try, test & understand - But first download & add JAR's of Java Mail API & Java Activation Framework to Netbeans Library Manager]
    Download Java Mail API here
    http://java.sun.com/products/javamail/
    Read Java Mail FAQ's here
    http://java.sun.com/products/javamail/FAQ.html
    Download Java Activation Framework [JAF]
    http://java.sun.com/products/javabeans/jaf/downloads/index.html
    Also, The POP program retrieves the mail sent with SMTP program :) [MOST IMPORTANT & LARGELY IN DEMAND]okey.. first things first... all of your thanks goes to the following and not a s@!te to me :)
    hail Java !!
    hail Java mail API !!
    hail Java forums !!
    hail Java-tips.org !!
    hail Netbeans !!
    Thanks to all coders who helped me by getting the code to work in one piece.
    special thanks to "bshannon" - The dude who runs this forum from 97!!I am just as happy as you will be when you execute the below code!! [my 13 hours of tweaking & code hunting has paid off!!]
    Now here it is...I only present you the complete solution!!
    START OF PROGRAM 1
    SENDING A MAIL FROM GMAIL ACCOUNT USING SMTP [STARTTLS (SSL)] PROTOCOL OF JAVA MAIL APINote on Program 1:
    1. In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
    2. Use the code to make your Gmail client [jsp/servlets whatever]
    //Mail.java - smtp sending starttls (ssl) authentication enabled
    //1.Open a new Java class in netbeans (default package of the project) and name it as "Mail.java"
    //2.Copy paste the entire code below and save it.
    //3.Right click on the file name in the left side panel and click "compile" then click "Run"
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class Main
        String  d_email = "[email protected]",
                d_password = "PASSWORD",
                d_host = "smtp.gmail.com",
                d_port  = "465",
                m_to = "[email protected]",
                m_subject = "Testing",
                m_text = "Hey, this is the testing email.";
        public Main()
            Properties props = new Properties();
            props.put("mail.smtp.user", d_email);
            props.put("mail.smtp.host", d_host);
            props.put("mail.smtp.port", d_port);
            props.put("mail.smtp.starttls.enable","true");
            props.put("mail.smtp.auth", "true");
            //props.put("mail.smtp.debug", "true");
            props.put("mail.smtp.socketFactory.port", d_port);
            props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.socketFactory.fallback", "false");
            SecurityManager security = System.getSecurityManager();
            try
                Authenticator auth = new SMTPAuthenticator();
                Session session = Session.getInstance(props, auth);
                //session.setDebug(true);
                MimeMessage msg = new MimeMessage(session);
                msg.setText(m_text);
                msg.setSubject(m_subject);
                msg.setFrom(new InternetAddress(d_email));
                msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
                Transport.send(msg);
            catch (Exception mex)
                mex.printStackTrace();
        public static void main(String[] args)
            Main blah = new Main();
        private class SMTPAuthenticator extends javax.mail.Authenticator
            public PasswordAuthentication getPasswordAuthentication()
                return new PasswordAuthentication(d_email, d_password);
    END OF PROGRAM 1-----
    START OF PROGRAM 2
    RETRIVE ALL THE MAILS FROM GMAIL INBOX USING Post Office Protocol POP3 [SSL] PROTOCOL OF JAVA MAIL APINote:
    1.Log into your gmail account via webmail [http://mail.google.com/]
    2.Click on "settings" and select "Mail Forwarding & POP3/IMAP"
    3.Select "enable POP for all mail" and "save changes"
    4.In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
    PROGRAM 2 - PART 1 - Main.java
    //1.Open a new Java class file in the default package
    //2.Copy paste the below code and rename it to Mail.java
    //3.Compile and execute this code.
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            try {
                GmailUtilities gmail = new GmailUtilities();
                gmail.setUserPass("[email protected]", "PASSWORD");
                gmail.connect();
                gmail.openFolder("INBOX");
                int totalMessages = gmail.getMessageCount();
                int newMessages = gmail.getNewMessageCount();
                System.out.println("Total messages = " + totalMessages);
                System.out.println("New messages = " + newMessages);
                System.out.println("-------------------------------");
    //Uncomment the below line to print the body of the message. Remember it will eat-up your bandwidth if you have 100's of messages.            //gmail.printAllMessageEnvelopes();
                gmail.printAllMessages();
            } catch(Exception e) {
                e.printStackTrace();
                System.exit(-1);
    END OF PART 1
    PROGRAM 2 - PART 2 - GmailUtilities.java
    //1.Open a new Java class in the project (default package)
    //2.Copy paste the below code
    //3.Compile - Don't execute this[Run]
    import com.sun.mail.pop3.POP3SSLStore;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Date;
    import java.util.Properties;
    import javax.mail.Address;
    import javax.mail.FetchProfile;
    import javax.mail.Flags;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Part;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.URLName;
    import javax.mail.internet.ContentType;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.ParseException;
    public class GmailUtilities {
        private Session session = null;
        private Store store = null;
        private String username, password;
        private Folder folder;
        public GmailUtilities() {
        public void setUserPass(String username, String password) {
            this.username = username;
            this.password = password;
        public void connect() throws Exception {
            String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
            Properties pop3Props = new Properties();
            pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
            pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
            pop3Props.setProperty("mail.pop3.port",  "995");
            pop3Props.setProperty("mail.pop3.socketFactory.port", "995");
            URLName url = new URLName("pop3", "pop.gmail.com", 995, "",
                    username, password);
            session = Session.getInstance(pop3Props, null);
            store = new POP3SSLStore(session, url);
            store.connect();
        public void openFolder(String folderName) throws Exception {
            // Open the Folder
            folder = store.getDefaultFolder();
            folder = folder.getFolder(folderName);
            if (folder == null) {
                throw new Exception("Invalid folder");
            // try to open read/write and if that fails try read-only
            try {
                folder.open(Folder.READ_WRITE);
            } catch (MessagingException ex) {
                folder.open(Folder.READ_ONLY);
        public void closeFolder() throws Exception {
            folder.close(false);
        public int getMessageCount() throws Exception {
            return folder.getMessageCount();
        public int getNewMessageCount() throws Exception {
            return folder.getNewMessageCount();
        public void disconnect() throws Exception {
            store.close();
        public void printMessage(int messageNo) throws Exception {
            System.out.println("Getting message number: " + messageNo);
            Message m = null;
            try {
                m = folder.getMessage(messageNo);
                dumpPart(m);
            } catch (IndexOutOfBoundsException iex) {
                System.out.println("Message number out of range");
        public void printAllMessageEnvelopes() throws Exception {
            // Attributes & Flags for all messages ..
            Message[] msgs = folder.getMessages();
            // Use a suitable FetchProfile
            FetchProfile fp = new FetchProfile();
            fp.add(FetchProfile.Item.ENVELOPE);       
            folder.fetch(msgs, fp);
            for (int i = 0; i < msgs.length; i++) {
                System.out.println("--------------------------");
                System.out.println("MESSAGE #" + (i + 1) + ":");
                dumpEnvelope(msgs);
    public void printAllMessages() throws Exception {
    // Attributes & Flags for all messages ..
    Message[] msgs = folder.getMessages();
    // Use a suitable FetchProfile
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.ENVELOPE);
    folder.fetch(msgs, fp);
    for (int i = 0; i < msgs.length; i++) {
    System.out.println("--------------------------");
    System.out.println("MESSAGE #" + (i + 1) + ":");
    dumpPart(msgs[i]);
    public static void dumpPart(Part p) throws Exception {
    if (p instanceof Message)
    dumpEnvelope((Message)p);
    String ct = p.getContentType();
    try {
    pr("CONTENT-TYPE: " + (new ContentType(ct)).toString());
    } catch (ParseException pex) {
    pr("BAD CONTENT-TYPE: " + ct);
    * Using isMimeType to determine the content type avoids
    * fetching the actual content data until we need it.
    if (p.isMimeType("text/plain")) {
    pr("This is plain text");
    pr("---------------------------");
    System.out.println((String)p.getContent());
    } else {
    // just a separator
    pr("---------------------------");
    public static void dumpEnvelope(Message m) throws Exception {       
    pr(" ");
    Address[] a;
    // FROM
    if ((a = m.getFrom()) != null) {
    for (int j = 0; j < a.length; j++)
    pr("FROM: " + a[j].toString());
    // TO
    if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
    for (int j = 0; j < a.length; j++) {
    pr("TO: " + a[j].toString());
    // SUBJECT
    pr("SUBJECT: " + m.getSubject());
    // DATE
    Date d = m.getSentDate();
    pr("SendDate: " +
    (d != null ? d.toString() : "UNKNOWN"));
    static String indentStr = " ";
    static int level = 0;
    * Print a, possibly indented, string.
    public static void pr(String s) {
    System.out.print(indentStr.substring(0, level * 2));
    System.out.println(s);
    }END OF PART 2
    END OF PROGRAM 2
    P.S: CHECKING !!
    STEP 1.
    First compile and execute the PROGRAM 1 with your USERNAME & PASSWORD. This will send a mail to your own account.
    STEP 2.
    Now compile both PART 1 & PART 2 of PROGRAM 2. Then, execute PART 1 - Main.java. This will retrive the mail sent in step 1. njoy! :)
    In future, I hope this is added to the demo programs of the Java Mail API download package.
    This is for 3 main reasons...
    1. To prevent a lot of silly questions being posted on this forum [like the ones I did :(].
    2. To give the first time Java Mail user with a real time working example without code modification [code has to use command line args like the demo programs - for instant results].
    3. Also, this is what google has to say..
    "The Gmail Team is committed to making sure you always can access your mail. That's why we're offering POP access and auto-forwarding. Both features are free for all Gmail users and we have no plans to charge for them in the future."
    http://mail.google.com/support/bin/answer.py?answer=13295
    I guess bshannon & Java Mail team is hearing this....
    Again, Hurray and thanks for helping me make it!! cheers & no more frowned faces!!
    (: (: (: (: (: GO JCODERS GO!! :) :) :) :) :)
    codeace
    -----                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Thanks for the reply,
    I did checked by enabling session debuging and also checked pop settings it's enabled for all
    mails, I tried deleting some very old messages and now the message count is changed to 310.
    This may be the problem with gmail.
    Bellow is the output i got,
    DEBUG: setDebug: JavaMail version 1.4ea
    DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
    DEBUG POP3: connecting to host "pop.gmail.com", port 995, isSSL false
    S: +OK Gpop ready for requests from 121.243.255.240 n22pf5432603pof.2
    C: USER [email protected]
    S: +OK send PASS
    C: PASS my_password
    S: +OK Welcome.
    C: STAT
    S: +OK 310 26900234
    Custom output: messageCount : 310
    C: QUIT
    S: +OK Farewell.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Is there any way of backing up Apple calendar in OSX Yosemite?

    I want an automated process/script that could run at a certain time of day and could back up my calendar automatically. I found a script that used to do so for iCal in earlier versions of OSX however since now iCal has been updated to Calendar the sc

  • Link to file doesnt work

    I want to download  active directory migration tool 3.2 from site, and i got link for that file  http://go.microsoft.com/fwlink/?LinkId=186197 You can see that link here : http://technet.microsoft.com/en-us/library/active-directory-migration-tool-ver

  • Exporting index with partition export using expdp

    Hi, I am using EXPDP export In 11.1.0.7, is there a way i can export indexes along with the partition export of a table. With full table export, indexes are exported, but i don't see this with only a single partition export because i don't see indexe

  • Problem with findAll method in CMP

    I have successfully deployed the CMP entity bean and am testing the findAll method when I reaslised that the result returned to the collection is limited to 100 records, although I have 150 records in the database. When I restarted the WLS and ran th

  • Canon Vixia HF S10 won't even mount to Macbook...

    I've got this camera and I know people are having problems with the AVCHD log and transfer issue but this thing won't even be recognized by my fairly new Macbook Pro via USB cable that came with the camera. Forget trying to figure out how to deal wit