简体   繁体   中英

Send email via Android app

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

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.

是有关如何在Android中发送电子邮件的分步教程。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM