2

I want to send email from my application using the default android email app. I have written a code for that as

Intent mailIntent = new Intent(android.content.Intent.ACTION_SEND);
mailIntent.setType("plain/text");
mailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { EMAIL });
mailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Invitation");
mailIntent.putExtra(android.content.Intent.EXTRA_TEXT,MAIL_MESSAGE);
startActivity(mailIntent);

But here it is opening the email application. I want to send the mail instead of starting any activity. Is there any ways to replace the startActivity and initiate the intent action?

Please help me.

Thanks in advance.

1

2 Answers 2

2

this link can be useful, have a look at another useful link or a code snippet from this link is attached below

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);  

emailIntent.setType("plain/text");  
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, newString[]{"[email protected]"});  
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mySubject);  

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, myBodyText);  

startActivity(Intent.createChooser(emailIntent, "Send mail));  

Hope that helps...

Sign up to request clarification or add additional context in comments.

Comments

0

yes you can done it by configuring the mail code on server side and from android call web service then server will send the mail

http://fahmirahman.wordpress.com/2011/04/21/connection-between-php-server-and-android-client-using-http-and-json/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.