sending email without user interaction android

前端 未结 3 592
隐瞒了意图╮
隐瞒了意图╮ 2021-01-15 16:43

I was trying to send email without user interaction. every thing worked until the part for sending.

This is the sendemail function in the Gmailsender class that I a

3条回答
  •  青春惊慌失措
    2021-01-15 17:22

    Word of warning if using "smtp.gmail.com" as the default smtp server.

    Google will force you to change your linked email account password frequently due to their over zealous "suspicious activity" polices. In essence it treats repeated smtp requests from different countries within a short time frame as "suspicious activity". As they assume you (the email account holder) can only be in one country at a time.

    When google systems detect "suspicious activity" it will prevent further emails until you change the password. As you will have hard coded the password into the app you have to re-release the app each time this happens, not ideal. This happened 3 times in a week to me, I even stored the password on another server and dynamically fetched the password each time google forced me to change it.

    So I recommend using one of the many free smtp providers instead of "smtp.gmail.com" to avoid this security problem. Use the same code but change "smtp.gmail.com" to your new smtp forwarding host.

提交回复
热议问题