Skip to content
Stanislav Koshutsky edited this page Feb 14, 2017 · 8 revisions

Basically its a set of handy methods to prepare an E-Mail using standard Android Intent.

isValidEmail(String emailAddressToCheck), boolean, returns true if given String might be a valid E-Mail address. Based on standard pattern.

Sending E-Mails methods with variety sets of parameters.

public static void sendEmail(Context context,
                             final String receiver,
                             final String subject,
                             final String text
)

Starts EMail intent with filled by given receiver (one and only), subject and text (message)

public static void sendEmail(Context context,
                             final String[] receivers,
                             final String subject,
                             final String text)

Starts EMail intent with filled by given receivers (array), subject and text

public static void sendEmail(final Context context,
                             final String receiver,
                             final String subject,
                             final String text,
                             final String pickerTitle,
                             final String securityErrorMessage,
                             final String noAssociatedAppErrorMessage)

Starts EMail intent with filled by given receiver (one), subject and text. pickerTitle is a title of E-Mail app picker/chooser. securityErrorMessage - custom message shown in case of security exception, noAssociatedAppErrorMessage - custom message shown in case of no E-Mail app could be found.

public static void sendEmail(final Context context,
                             final String[] receivers,
                             final String subject,
                             final String text,
                             String pickerTitle,
                             String securityExceptionMessage,
                             String noAssociatedAppErrorMessage) 

Starts EMail intent with filled by given receivers (array), subject and text. pickerTitle is a title of E-Mail app picker/chooser. securityErrorMessage - custom message shown in case of security exception, noAssociatedAppErrorMessage - custom message shown in case of no E-Mail app could be found.

mail with attaches public static void sendEmail(Context context, final String receiver, final String subject, final String text, final File... files) Starts EMail intent with filled by given receiver (one), subject, text and Files as attachments.

public static void sendEmail(Context context,
                             final String[] receivers,
                             final String subject,
                             final String text,
                             final File... files)

Starts E-Mail intent with filled by given receivers (array), subject, text and array of files as attaches.

public static void sendEmail(Context context,
                             final String receiver,
                             final String subject,
                             final String text,
                             final String pickerTitle,
                             final String securityErrorMessage,
                             final String noAssociatedAppErrorMessage,
                             final File... files)

Starts EMail intent with filled by given receiver (one), subject, text and Files as attachments. pickerTitle is a title of E-Mail app picker/chooser. securityErrorMessage - custom message shown in case of security exception, noAssociatedAppErrorMessage - custom message shown in case of no E-Mail app could be found.

public static void sendEmail(Context context,
                             final String[] receivers,
                             final String subject,
                             final String text,
                             String pickerTitle,
                             String securityExceptionMessage,
                             String noAssociatedAppErrorMessage,
                             final File... files) 

Starts E-Mail intent with filled by given receivers (array), subject, text and array of files as attaches. pickerTitle is a title of E-Mail app picker/chooser. securityErrorMessage - custom message shown in case of security exception, noAssociatedAppErrorMessage - custom message shown in case of no E-Mail app could be found.

Clone this wiki locally