Uri email android developer
Here is the URI for an email address in Android:
mailto:<email_address>?subject=<subject>&body=<body>
Here:
<email_address>
is the recipient's email address.<subject>
is the subject of the email.<body>
is the body of the email.
For example:
mailto:[email protected]?subject=Hello&body=This%20is%20a%20test%20email
This URI will open the default email client on the device and compose a new email with the specified subject and body.
You can also add additional parameters to the URI to customize the email composition experience. Some common parameters include:
to
: specifies the recipient's email address.cc
: specifies the carbon copy recipient's email address.bcc
: specifies the blind carbon copy recipient's email address.subject
: specifies the subject of the email.body
: specifies the body of the email.attachment
: specifies the file to attach to the email.
For example:
mailto:[email protected][email protected]&[email protected]&subject=Hello&body=This%20is%20a%20test%20email&attachment=file.txt
This URI will open the default email client on the device and compose a new email with the specified subject, body, and attachment.
You can use this URI in your Android app by using the Intent
class to launch the email client. For example:
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:[email protected]?subject=Hello&body=This%20is%20a%20test%20email"));
startActivity(intent);
This code will launch the default email client on the device and compose a new email with the specified subject and body.