开发者

Email sending via Android Application

开发者 https://www.devze.com 2023-03-08 14:26 出处:网络
I want to send email from my application without configuration email in android device. can we do this?? we click a button and mail will automatically to the recipient.

I want to send email from my application without configuration email in android device. can we do this?? we click a button and mail will automatically to the recipient.

I have used the following code. where we can give the sender name. and can we send mail via android emulator.

Thanx.

                Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("text/plain");
                intent.putExtra(Intent.EXTRA_EMAIL  , new String[]{"abc@example.com"});
                intent.putExtra(Intent.EXTRA_SUBJECT, "Request For Quote");
                intent.putExtra(Intent.EXTRA_TEXT   , "Hi....");
                try {
                    //startActivity(Intent.createChooser(intent, "Send mail..."));
                    startActivity(intent);
                    //Toast.makeText(SendingEmailActivity.this, "Mail Sent Successfully", Toast.LENGTH_SHORT).show();

                } catch (android.content.ActivityNotFoundException ex) {
                    Toast.makeText(DemoActivity.this, "There are no email cli开发者_C百科ents installed.", Toast.LENGTH_SHORT).show();
                } 


Check this thread

Sending Email in Android using JavaMail API without using the default/built-in app


Without any intervention, you couldn't use Intents.

Take a look at This tutorial about javamail and android

0

精彩评论

暂无评论...
验证码 换一张
取 消