我已经创建了登录演示。我正在使用与 PHP 代码连接的 JSON 解析器解析用户名和密码。我还完成了忘记密码的代码。但我无法收到任何邮件。为什么?我已经创建了一个忘记密码活动用于输入电子邮件 ID 的一个文本字段,当我点击提交按钮时,邮件应该与密码一起发送到我的收件箱。怎么做?有人请帮我吗?
这是我忘记密码的代码:
package com.Login;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class ForgotPassActivity extends Activity {
EditText address, subject, emailbody, et_email;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.forgot_password);
TextView textv = (TextView) findViewById(R.id.lbl_loginhere);
et_email = (EditText) findViewById(R.id.et_email);
textv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
ForgotPassActivity.this.finish();
Intent intent = new Intent();
intent.setClass(v.getContext(), LoginActivity.class);
startActivity(intent);
}
//Code For Sending mail
});
Button b1 = (Button) findViewById(R.id.submitButton);
b1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
sendEmail();
}
});
}
public void sendEmail(){
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"testmail@testmail.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText());
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailbody.getText());
ForgotPassActivity.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
}