0

I am using Javamail api and gmail smtp server to send mail in java without giving password. I have using the below code. here i am using javax.mail jar file

     Properties props= new Properties();

     props.put("mail.smtp.host", "smtp.gmail.com");
     props.put("mail.smtp.port", 587);
     props.put("mail.transport.protocal", "smtps");
     //Put below to false, if no https is needed
     props.put("mail.smtp.STARTTLS.enable", "false");
     props.put("mail.smtp.auth", "false");

     Session session = Session.getInstance(props);

I am getting the below error

      Must issue a STARTTLS command first. b4sm3005855pdh.2 - gsmtp

Is there any wrong in implementing the code? is it posssible to implement without password ? pls any one help me on this

2
  • What is your question? Commented Oct 10, 2014 at 13:43
  • You've also misspelt "protocol". Commented Oct 11, 2014 at 7:36

2 Answers 2

1

First, the name of the property is "mail.smtp.starttls.enable".

Second, no, you can't send mail through Gmail without authenticating first, e.g., using your password.

Sign up to request clarification or add additional context in comments.

Comments

0

I Think it is not possible . if it will happen , any body can misuse of any other's mail address.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.