In my application, users are registered and their data is displayed on the web server. I want to add a password recovery function in which, when entering a login, a letter with a randomly generated password is sent from the support service address (xxxxxxxx@mail.ru, password xxxxxxxx) to the user's mail (any domain). How can I send an email using java?
- This is more a question for the server side, and not for Android developers - pavel163
- In the android environment can not send a letter? - Hayk Abelyan
- Do you have a support service on your android device? - pavel163
- Just judging by the problem the case is this: the client from the device sends a request to the server to change the password. On the server they generate a new password and send it to the mail to the client. I do not see the place where the android should send mail. I can not understand that? - pavel163
- And how the password is sent to the mail client? My application somehow has to promote with the mail server. - Hayk Abelyan
|
1 answer
Can. For this you need to use small libraries that can be found here.
Then change _host = "smtp.gmail.com" to _host = "smtp.mail.ru" and should work. I did not try it with mail.ru , but it mail.ru with other mails.
- The link jar file was not found, downloaded from another place, added. For each one: right click-> Build Path-> Add to Build Path This is for eclipse. And how to be in Android Studio? - Hayk Abelyan
- Clicking "Add as library" shows the error Configuration with name 'default not found - Hayk Abelyan
- @HaykAbelyan just drop these three folders into the libs folder, rebuild the gradle and use the class described in the link - Peter Parker
- Strange, but not sent through mail.ru or through gmail. Everywhere System.err javax.mail.internet. Internet. 2054) javax.mail. Mail.send (Mail.java:104) The problem is in the Transport.send method (msg) in the copied Mail class. - Hayk Abelyan
- Another solution was found here, it works with various mail servers: ssaurel.com/blog/… - Hayk Abelyan
|