Results 1 to 2 of 2
  1. #1
    frost750 is offline Member
    Join Date
    Dec 2008
    Posts
    2
    Rep Power
    0

    Default [SOLVED] JavaMail Authentication Problem

    Brand new to the JavaMail API. Using the following code to try and send a message from my Java desktop application:

    String protocol = "smtp";

    Properties props = new Properties();
    props.put("mail.smtp.host", "smtp.*****.***");
    props.put("mail.from", "*********@u.washington.edu");
    props.put("mail." + protocol + ".auth", "true");
    Session session = Session.getInstance(props, null);

    try
    { MimeMessage msg = new MimeMessage(session);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO, "********@hotmail.com");
    msg.setSubject("a test");
    msg.setSentDate(new Date());
    msg.setText("a test message\n");
    Transport t = session.getTransport(protocol);

    try
    { t.connect("*******", "*********");
    t.sendMessage(msg, msg.getAllRecipients());
    } finally { t.close(); }

    } catch (MessagingException mex) { System.out.println("send failed, exception: " + mex); }

    The usernames and passwords have been replaced with the ****. This question has probably been asked before but I cannot find a thread with search. The error i get is:

    send failed, exception: javax.mail.SendFailedException: Invalid Addresses;
    nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.1 Relaying denied. Proper authentication required.

    When googling for a solution I find many having similar problems except that the error code they get is 550. I have tried several solutions that have worked for others but every single attempt gives me the 530. The username, password and mail server are all valid. Thanks for any suggestions.

  2. #2
    frost750 is offline Member
    Join Date
    Dec 2008
    Posts
    2
    Rep Power
    0

    Default

    Problem was solved by adding the following line of code.

    props.put("mail.smtp.starttls.enable","true");

Similar Threads

  1. Javamail
    By v_mallikarjun in forum Advanced Java
    Replies: 14
    Last Post: 04-18-2008, 08:32 PM
  2. Using JavaMail API
    By consult4u in forum Networking
    Replies: 0
    Last Post: 08-09-2007, 11:15 AM
  3. This is Regarding JSP with javamail
    By venkatkomalli in forum Advanced Java
    Replies: 3
    Last Post: 07-19-2007, 03:07 PM
  4. 530 5.7.0 Authentication Required - JavaMail gmail
    By simon in forum Advanced Java
    Replies: 1
    Last Post: 07-15-2007, 12:52 AM
  5. JavaMail:Authentication required error
    By bbq in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 05:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •