We want to implement Contact Us button.
User will be able to send an e-mail to my designated mailbox. [I might check it :)]
1.
Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}); 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(); }
But this requires e-mail client (?) and doesnt have sender address. How would I respond then?
2.Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email"); intent.putExtra(Intent.EXTRA_TEXT, "Body of email"); intent.setData(Uri.parse("mailto:default@recipient.com")); // or just "mailto:" for blank intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app. startActivity(intent);
3. http://stackoverflow.com/questions/2197741/how-to-send-email-from-my-android-application
more code examples.
One of these should work I hope.