I am trying to send mail using java mail api..Every thing is ok in the code except the Authenticator class .It is giving warning as ...
Constructor PasswordAuthentication can not be applied to given types.
required java.lang.String,java.lang.char[]
Here is my code snippet where i am getting warning error but not able to resolve the issue...
Authenticator auth = new Authenticator() {
@Override
public PasswordAuthentication getPasswordAuthentication() {
error return new PasswordAuthentication(userName, password);
}
};
error Session session = Session.getInstance(properties, auth);
These two lines with //error is giving error in the code..
Please help me. Thanks in advance..
getPasswordnote it returns achar[], not aString. You can convert it vianew String(char[]).