Android Utililty Methods Email Send

List of utility methods to do Email Send

Description

The list of methods to do Email Send are organized into topic(s).

Method

voidsendEmail(@Nonnull Context context, @Nullable String chooserMessage, @Nonnull String[] recipients, @Nullable String subject, @Nullable String message)
Create a chooser intent to open the email composer with the specified email recipients, subject and message.
final Intent emailIntent = new Intent(
        android.content.Intent.ACTION_SEND);
emailIntent
        .putExtra(android.content.Intent.EXTRA_EMAIL, recipients);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
emailIntent.setType("plain/text");
final Intent intent = Intent.createChooser(emailIntent,
...
voidsendEmail(@Nonnull Context context, @Nullable String chooserMessage, @Nullable String recipient, @Nullable String subject, @Nullable String message)
Create a chooser intent to open the email composer with the specified single email recipient, subject and message.
sendEmail(context, chooserMessage, new String[] { recipient },
        subject, message);
voidsendEmail(Activity oActivity, String strTo, String strSubject, String strText)
send Email
final Intent emailIntent = new Intent(
        android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
        new String[] { strTo });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
        strSubject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, strText);
...
voidshareViaEmail(Context context, String subject, String text)
share Via Email
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("text/html");
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
context.startActivity(Intent.createChooser(intent,
        "Share via Email"));