email sent without putting the password into the code

大兔子大兔子 提交于 2019-12-24 00:51:54

问题


Is there anyway to get an email sent without putting the password into the code ?

There are many email api-s that enables to send an email with entering the username and password.

Example

sendEmail("myemail@gmail.com","mypass","subject","msg body"); 

Is there any way around the problem with hard-coding the password in code ?


回答1:


You have three options to send email:

  1. You include your email and password into the code and in this case the application will send emails from this email address.
  2. You can ask user to enter his credentials for his email and in this case you'll receive a mail from user's address.
  3. You can form an intent in your application that will fill neccessary fields and call user's email client to send this.

If you want silent way to send email then you should choose 1 or 2. But more secure way is to use the third approach.




回答2:


You can ask the user password one time and then store it in your internal storage. It may be necessary to add a way to change the password later if preferred. Deciding from documentation, the internal storage is even secure, while it is also possible to use additional encryption. This is how most of E-mail clients work.



来源:https://stackoverflow.com/questions/8614844/email-sent-without-putting-the-password-into-the-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!