【发布时间】:2021-12-27 07:00:38
【问题描述】:
我从 API 获得了忘记的密码。我想将该密码发送到电子邮件地址。我尝试了很多选项,但仍然无法发送该密码。
【问题讨论】:
-
必须从服务器端完成。如果您想在客户端做最好的选择是启动电子邮件意图,在这种情况下,您无法控制电子邮件 ID,用户可能会忽略发送。客户端完全不推荐。
标签: android android-studio forgot-password
我从 API 获得了忘记的密码。我想将该密码发送到电子邮件地址。我尝试了很多选项,但仍然无法发送该密码。
【问题讨论】:
标签: android android-studio forgot-password
我们可以用this tutorial发送邮件
BackgroundMail.newBuilder(this)
.withUsername(from - emailid)
.withPassword(from - emailid password)
.withMailto(to - emailid)
.withType(BackgroundMail.TYPE_PLAIN)
.withSubject("Subject")
.withSendingMessageSuccess("email sent successfully")
.withBody("Body")
.withOnSuccessCallback(new BackgroundMail.OnSuccessCallback() {
@Override
public void onSuccess() {
finish();
}
})
.withOnFailCallback(new BackgroundMail.OnFailCallback() {
@Override
public void onFail() {
}
})
.send();
【讨论】:
最好的方法是从您的后端使用 smtp 标头,因为它是敏感数据,因此更加安全和高效......永远不要让您的客户端知道这种数据类型。您可以按照 this 教程使用 bash 完成此操作
【讨论】: