I am developing an application in Android. I don't know how to send an email from the application?
If you can't send email try the following: Open your email application. Tap Menu and then Account Settings. If the settings are correct try setting the Security type to None and the Port to 25 or 587.
Use .setType("message/rfc822")
or the chooser will show you all of the (many) applications that support the send intent.
The best (and easiest) way is to use an Intent
:
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(); }
Otherwise you'll have to write your own client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With