如何發送電子郵件的代碼從我的手機到我的帳戶而不使用意圖? 我的意思是沒有得到彈出窗口,要求我用我發送電子郵件的巫婆應用程序。如何從Android手機發送電子郵件到我的電子郵件沒有使用意圖
這是我用的意圖。
package com.example.emaildemo;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
Button btnSendEmail;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSendEmail = (Button) findViewById(R.id.btnSendEmail);
btnSendEmail.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
String[] to = {"[email protected]"};
String[] cc = {"[email protected]"};
sendEmail(to, cc, "Hello", "Hello my friends!");
}
});
}
//---sends an SMS message to another device---
private void sendEmail(String[] emailAddresses, String[] carbonCopies,
String subject, String message)
{
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.putExtra(Intent.EXTRA_EMAIL, emailAddresses);
emailIntent.putExtra(Intent.EXTRA_CC, carbonCopies);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, message);
emailIntent.setType("message/rfc822");
emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(Intent.createChooser(emailIntent, "Email"));
}
}
,但我想那是什麼,我需要從我的手機發郵件到我的帳戶
因此,如果有人能幫助我,我會理解,