简体   繁体   中英

How to send an email from a specific mail to some other email id?

I want to email some credentials to a specific email address. From what email address will this mail be sent?

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL  , new
String[]{"recipient@example.com"}); i.putExtra(Intent.EXTRA_SUBJECT,
"subject of email"); i.putExtra(Intent.EXTRA_TEXT   , "body of
email");
try {
    startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}

Who is the sender here?

This intent will open the mail clients available in your device. Then its up to you to add sender email ID. Or it will take default email ID if you have already logged in.

You should use JavaMail Api for this You can send & access email with the help of this:-- Check this !

& here is the library !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM