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

Compass
  • 5,867
  • 4
  • 30
  • 42
user3790095
  • 3
  • 1
  • 3

2 Answers2

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.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40
0

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

praveen_programmer
  • 1,072
  • 11
  • 25