public final class EmailIntentBuilder
extends java.lang.Object
Intent.ACTION_SENDTO with a mailto: URI.
Example usage:
EmailIntentBuilder.from(activity)
.to("alice@example.org")
.subject("Bug report for 'My awesome app'")
.body("Something went wrong :(")
.start();
This creates an intent containing the following mailto: URI:
mailto:alice@example.org?subject=Bug%20report%20for%20'My%20awesome%20app'&body=Something%20went%20wrong%20%3A(
from(Context)| Modifier and Type | Method and Description |
|---|---|
EmailIntentBuilder |
bcc(java.util.Collection<java.lang.String> bcc)
Add an email address to be used in the "bcc" field.
|
EmailIntentBuilder |
bcc(java.lang.String bcc)
Add an email address to be used in the "bcc" field.
|
EmailIntentBuilder |
body(java.lang.String body)
Set the text body for this email intent.
|
android.content.Intent |
build()
Build the
Intent.ACTION_SENDTO intent. |
EmailIntentBuilder |
cc(java.util.Collection<java.lang.String> cc)
Add an email address to be used in the "cc" field.
|
EmailIntentBuilder |
cc(java.lang.String cc)
Add an email address to be used in the "cc" field.
|
static EmailIntentBuilder |
from(android.content.Context context)
Create a builder to create an
Intent.ACTION_SENDTO intent or to launch that intent. |
boolean |
start()
Launch the email intent.
|
EmailIntentBuilder |
subject(java.lang.String subject)
Set the subject line for this email intent.
|
EmailIntentBuilder |
to(java.util.Collection<java.lang.String> to)
Add a list of email addresses to be used in the "to" field.
|
EmailIntentBuilder |
to(java.lang.String to)
Add an email address to be used in the "to" field.
|
public static EmailIntentBuilder from(android.content.Context context)
Intent.ACTION_SENDTO intent or to launch that intent.context - The Context that will be used to launch the intentpublic EmailIntentBuilder to(java.lang.String to)
to - the email address to addEmailIntentBuilder for method chainingpublic EmailIntentBuilder to(java.util.Collection<java.lang.String> to)
to - the email addresses to addEmailIntentBuilder for method chainingpublic EmailIntentBuilder cc(java.lang.String cc)
cc - the email address to addEmailIntentBuilder for method chainingpublic EmailIntentBuilder cc(java.util.Collection<java.lang.String> cc)
cc - the email addresses to addEmailIntentBuilder for method chainingpublic EmailIntentBuilder bcc(java.lang.String bcc)
bcc - the email address to addEmailIntentBuilder for method chainingpublic EmailIntentBuilder bcc(java.util.Collection<java.lang.String> bcc)
bcc - the email addresses to addEmailIntentBuilder for method chainingpublic EmailIntentBuilder subject(java.lang.String subject)
subject - the email subject lineEmailIntentBuilder for method chainingpublic EmailIntentBuilder body(java.lang.String body)
body - the text bodyEmailIntentBuilder for method chainingpublic boolean start()
false if no activity to handle the email intent could be found; true otherwisepublic android.content.Intent build()
Intent.ACTION_SENDTO intent.