I want to send email via my application and I am doing that by using intent and android system shows list of various component for this intent, but I do not want to send email with the help of these components, I want to send email via my application. Any help will be appreciated?
Asked
Active
Viewed 594 times
2 Answers
2
You can send e-mail in Android using the JavaMail API using Gmail authentication
Have a look at this post,
Sending Email in Android using JavaMail API without using the default/built-in app

Community
- 1
- 1

Sahil Mahajan Mj
- 11,033
- 8
- 53
- 100
-
1@adhir Yes, you can accept answer by clicking on the check mark along with the answer. just tick it. You should also answers on your previous questions, so as to have a good accep rate. – Sahil Mahajan Mj Jan 24 '13 at 13:37
0
Yes, it's possible. Hee you have good tutorial : http://thedevelopersinfo.wordpress.com/2009/10/22/email-sending-in-android/. I hope I helped.
Code snippet :
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
/**
* Class which shows how to send email
*
* @author FaYna Soft Labs
*/
public class Main extends Activity {
private Button clickBtn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
clickBtn = (Button) findViewById(R.id.click);
clickBtn.setText("Send email");
clickBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String[] recipients = new String[]{"my@email.com", "",};
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is email's message");
emailIntent.setType("text/plain");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
}
});
}

TN888
- 7,659
- 9
- 48
- 84