0

I've been trying to write a program which can send emails and I've gone to this topic.

However, neither of its answers work. I tried the the code given in the accepted answer and Android SDK is giving me this alert: no application may perform this action. The other code, given by yuku, gives Unsopported action: This action is not currently supported alert.

Can someone help me with this? Any step by step tutorials? By the way, I would prefer a solution which doesn't require a prompt asking which email server is the user using, but that's optional and extra for now.

I also tried: Sending e-Mail in Android

Community
  • 1
  • 1
behzad.robot
  • 587
  • 1
  • 5
  • 16

2 Answers2

0

There are two ways, the first, best and easiest ways is using the email intent.

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, "email@domain.ext");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "body");

startActivity(Intent.createChooser(intent, "Send Email"));

Another way is to code a server-side script that sends email, in php, python are any other server-side language and then connect to it from your app to send emails.

Ali Alnoaimi
  • 2,278
  • 2
  • 21
  • 31
  • Thank u at last i'm not getting errors!but it's sending a MMS mail not an email! therefore i cant find it in the reciptants inbox – behzad.robot Jul 11 '13 at 12:48
0

Here is a step by step tutorial on how to send email in Android.

Saqib Razaq
  • 864
  • 1
  • 7
  • 13
  • hmmm frist it told me that my phone(emulator thing) doesnt have any mail service so i installed one then it wasnt working...but that seems good – behzad.robot Jul 11 '13 at 13:51