How to open gmail in Android… here is a solution to the problem.
How to open gmail in Android
I just want to open the Gmail app through my app and want to set up emails, subjects, and messages through my app.
I tried GmailService, but it doesn’t support Bcc or CC emails.
Link: https://github.com/yesidlazaro/GmailBackground
BackgroundMail.newBuilder(this)
.withUsername("[email protected]")
.withPassword("password12345")
.withMailto("[email protected]")
.withType(BackgroundMail.TYPE_PLAIN)
.withSubject("this is the subject")
.withBody("this is the body")
.withOnSuccessCallback(new BackgroundMail.OnSuccessCallback() {
@Override
public void onSuccess() {
do some magic
}
}).withOnFailCallback(new BackgroundMail.OnFailCallback() {
@Override
public void onFail() {
do some magic
}
}).send();
I want to use the Bcc and CC features along with attachments, subjects, and messages.
Solution
Email for any application
Intent email= new Intent(Intent.ACTION_SENDTO);
email.setData(Uri.parse("mailto:[email protected]"));
email.putExtra(Intent.EXTRA_SUBJECT, "Subject");
email.putExtra(Intent.EXTRA_TEXT, "My Email message");
startActivity(email);