setup email connection in java

I am trying to make connection to the email server using property files and session store value. and all the parameters are given dynamically. this is what i'm trying

  Properties props = System.getProperties();
  props.put("mail.smtp.auth", "true");
  props.put("mail.smtp.starttls.enable", "true");
  props.put("", emailHost);
  props.put("mail.smtp.port", "2525");
  Session sessions = Session.getDefaultInstance(props);
  Store store = sessions.getStore(emailAccType);
  store.connect(emailHost, emailId, emailPwd);

Even if i am giving the correct email and password, the connection is not setting up.

please do the needful help.

Thanks in advance.


Couple of ideas:

  1. make sure the email server does not require pop3 login first.
  2. make sure port is open in firewall

Do you get any exceptions during your tries?

Does it throw an exception or it just doesn't work? I am using gmail for sending emails and I used something like this:

Session.getInstance(props, new javax.mail.Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(email, password);

Need Your Help

JIRA JQL - Find all subtasks that are in X status, where the parent is in X status

jira jql

I'm having an issue where I can't see the status of the parent task, and can only see the status of the sub-task. I would like to find all sub-tasks that are in a certain 'status' where the parent of