title: Authentication Error with Java Mail
body: <p>I'm using the Java Mail API for the first time and I can't get things working. My server requires authentication, so I'm having to use that. I keep getting the following error:</p>
  
  <pre><code>&gt; 250-PIPELINING 250-SIZE 40960000
  &gt; 250-ETRN 250-STARTTLS 250-AUTH PLAIN
  &gt; LOGIN 250-AUTH=PLAIN LOGIN
  &gt; 250-ENHANCEDSTATUSCODES 250 8BITMIME
  &gt; DEBUG SMTP: Found extension
  &gt; "PIPELINING", arg "" DEBUG SMTP: Found
  &gt; extension "SIZE", arg "40960000" DEBUG
  &gt; SMTP: Found extension "ETRN", arg ""
  &gt; DEBUG SMTP: Found extension
  &gt; "STARTTLS", arg "" DEBUG SMTP: Found
  &gt; extension "AUTH", arg "PLAIN LOGIN"
  &gt; DEBUG SMTP: Found extension
  &gt; "AUTH=PLAIN", arg "LOGIN" DEBUG SMTP:
  &gt; Found extension "ENHANCEDSTATUSCODES",
  &gt; arg "" DEBUG SMTP: Found extension
  &gt; "8BITMIME", arg "" DEBUG SMTP: Attempt
  &gt; to authenticate DEBUG SMTP: check
  &gt; mechanisms: LOGIN PLAIN AUTH LOGIN 334
  &gt; Base64text base64text 334 base64text
  &gt; base64text 235 2.7.0 Authentication
  &gt; successful DEBUG: getProvider()
  &gt; returning
  &gt; javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
  &gt; Microsystems, Inc] DEBUG SMTP: useEhlo
  &gt; true, useAuth true
  &gt; javax.mail.AuthenticationFailedException:
  &gt; failed to connect, no password
  &gt; specified?
  &gt;         at javax.mail.Service.connect(Service.java:329)
  &gt;         at javax.mail.Service.connect(Service.java:176)
  &gt;         at javax.mail.Service.connect(Service.java:125)
  &gt;         at javax.mail.Transport.send0(Transport.java:194)
  &gt;         at javax.mail.Transport.send(Transport.java:124)
  &gt;         at Mailman.main(Mailman.java:61)
  </code></pre>
  
  <p>As you can see, I'm getting an "Authentication successful" message, but then it kicks me out on an "AuthenticationFailedException." I'm stumped...</p>
  
  <p>Here's the relevant part of the source:</p>
  
  <pre><code>properties.setProperty("mail.smtp.host", host);               
        properties.setProperty("mail.smtp.port", "25");
  
  
        properties.setProperty("mail.smtp.user", "myemailhere");
        properties.setProperty("mail.smtp.password", "mypasshere");
        properties.setProperty("mail.smtp.auth", "true");       
        properties.setProperty("mail.debug", "true");
  
  
        // Get the default Session object.
        Session session = Session.getDefaultInstance(properties);
  
        try{
           // Create a default MimeMessage object.
           MimeMessage message = new MimeMessage(session);
  
           // Set From: header field of the header.
           message.setFrom(new InternetAddress(from));
  
           // Set To: header field of the header.
           message.addRecipient(Message.RecipientType.TO,
                                    new InternetAddress(to));
  
           // Set Subject: header field
           message.setSubject("This is the Subject Line!");
  
           // Now set the actual message
           message.setText("This is actual message");
  
           Transport transport = session.getTransport("smtp");
              transport.connect(host, 25, "myemailhere", "mypasshere");
              message.saveChanges();
              Transport.send(message);
  
  
  
           // Send message
           Transport.send(message);
           System.out.println("Sent message successfully....");
        }catch (MessagingException mex) {
           mex.printStackTrace();          
        }       
  </code></pre>
  
  <p>Any suggestions would be GREATLY appreciated...</p>