Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending email via Android App needs permissions?

I need to use the email feature when the user of my app need to send any feedback to developer. I am going to use the below code. I wonder if this needs any permission setup in Manifest file.

Please advice, If this needs any permission that has to be setup in Manifest file

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"[email protected]"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
try {
    startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(MyActivity.this, "There are no email clients installed.",Toast.LENGTH_SHORT).show();
}
like image 286
iappmaker Avatar asked Jan 08 '23 03:01

iappmaker


2 Answers

I checked and no, you don't need any permissions setup in AndroidManifest.xml to send email.

like image 195
Suhas Avatar answered Jan 28 '23 09:01

Suhas


your code does not need any permission for sending email but if you want to send email using libraries like mail.jar you must add Internet permission to the manifest file.

like image 20
karimkhan Avatar answered Jan 28 '23 08:01

karimkhan