无法发送密码提醒邮件
Can't send a password reminder email
我试过创建某种密码提醒,将密码发送到用户电子邮件。
相反,每当我尝试通过应用程序发送此邮件时,我只会进入发送短信页面。
我使用的是最新的 android 工作室版本。
public void ForgetPasswordEvent (View view) {
//AlertDialog recovery = new AlertDialog();
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Please enter your registered email");
// Set up the input
final EditText input = new EditText(this);
// Specify the type of input expected;
input.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
builder.setView(input);
// Set up the buttons
builder.setPositiveButton("Send", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_Text= input.getText().toString();
Log.i("Send email", "");
// String[] TO = {m_Text.toString()};
String[] TO = {"erez@manageyourtrip.com"};
String[] CC = {"erez@manageyourtrip.com"};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "MYT GuideApp password recovery");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Your password is 123456");
try {
startActivity(createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
setType("text/plain")
太"wide".
你应该使用类似的东西:
setType("message/rfc822")
免责声明:我仍然不赞成这种功能。我不会使用(或推荐)能够发送我的密码的应用程序。
来源:Another question asking the same thing
我试过创建某种密码提醒,将密码发送到用户电子邮件。 相反,每当我尝试通过应用程序发送此邮件时,我只会进入发送短信页面。 我使用的是最新的 android 工作室版本。
public void ForgetPasswordEvent (View view) {
//AlertDialog recovery = new AlertDialog();
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Please enter your registered email");
// Set up the input
final EditText input = new EditText(this);
// Specify the type of input expected;
input.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
builder.setView(input);
// Set up the buttons
builder.setPositiveButton("Send", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_Text= input.getText().toString();
Log.i("Send email", "");
// String[] TO = {m_Text.toString()};
String[] TO = {"erez@manageyourtrip.com"};
String[] CC = {"erez@manageyourtrip.com"};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "MYT GuideApp password recovery");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Your password is 123456");
try {
startActivity(createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
setType("text/plain")
太"wide".
你应该使用类似的东西:
setType("message/rfc822")
免责声明:我仍然不赞成这种功能。我不会使用(或推荐)能够发送我的密码的应用程序。
来源:Another question asking the same thing