In Android we can send Email using following Code
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recieveremail@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "Subject of Mail");
i.putExtra(Intent.EXTRA_TEXT , "The Message Body");
try {
startActivity(Intent.createChooser(i, "Sending mail..."));
}
finally {
// Code to execute when unable to send Email
}
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recieveremail@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "Subject of Mail");
i.putExtra(Intent.EXTRA_TEXT , "The Message Body");
try {
startActivity(Intent.createChooser(i, "Sending mail..."));
}
finally {
// Code to execute when unable to send Email
}
Hello
ReplyDeleteCould you also tell us how to mail attachments?
To attache files in Email yuu need to use Intent.EXTRA_STREAM
DeleteFor Ex:
ArrayList uris = new ArrayList();
i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivityForResult(Intent.createChooser(i, "Sending multiple attachment"), 12345);
Hi.
ReplyDeleteCan you please tell how to send mail directly from the app.. without using any mail client.
Regards.
This comment has been removed by the author.
ReplyDeletePlease anyone can tell how to send mails from app....without client interference. ...please
ReplyDeleteMua vé tại Aivivu, tham khảo
ReplyDeletegiá vé máy bay đi Mỹ khứ hồi
bay từ mỹ về việt nam
vé máy bay từ đức về việt nam
khi nào có chuyến bay từ nga về việt nam
bay từ anh về việt nam
chuyến bay từ Paris về Hà Nội
khách sạn được cách ly tại hà nội
chuyen bay danh cho chuyen gia