Is there way to send email through JavaMail without implicity setting password in Java code (or properties file)?
Is there way to send email through JavaMail without implicity setting password in Java
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume that by “without implicity setting password in Java code “ you mean “without hardcoding the password such that others can see it”.
If your SMTP server requires a password then the client program (the one sending the emails) must provide it, and get it from somewhere. The three choices are
That’s about it. If your client is not running in a secure environment (where you control who has access to the properties file) it probably shouldn’t be accessing a secure service in this fashion.
One possible alternative is to write your own intermediate service. The client connects to your service, which can examine and discard anything inappropriate, and which connects to the real email server (with the password) only for those send attempts that pass verification. Your service wouldn’t need to implement SMTP; it could be a simple POST servlet.