I tried to send email automatically when i click on button
but without success.
Here is my code to add my files and opening gmail (with intent).
I need to send the email automatically when I click on the button
.
(uris object is ArrayList that I add a files)
How can I do it?
public void onClick(View view)
{
try
{
// Intent to send the email
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
// Set the type to 'email'
emailIntent .setType("vnd.android.cursor.dir/email");
String to[] = {"niravisrur1@gmail.com"};
emailIntent.putExtra(Intent.EXTRA_EMAIL, to);
// The attachment
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
// The mail subject
startActivity(Intent.createChooser(emailIntent , "Send email..."));
}
}
catch (Exception e)
{
Log.e("SendMail", e.getMessage(), e);
}