I am currently working on an Android application which has an "ask a question form", where user type a question and send it to predetermined email address. I would like to know how I can allow the application to capture what the user has input and send the input directly to a predeteremined email using button, either without bringing the user to the email app page, or capture all user input and send it to the built in email intent. I have seen many question related to my question but I just want to confirm that if I follow this Sending Email in Android using JavaMail API without using the default/built-in app
answer, would it allow me to capture user input and send it to pre determined email address?
Following is the code I tried
public void onClick(View v) {
// TODO Auto-generated method stub
convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated();
String[] to = {"someone@hotmail.co.uk"};
String message[] = {name} ;
String message2 [] = {mobile} ;
String message3 [] = {email2} ;
String message4 [] = {question} ;
Intent Emailintent = new Intent(android.content.Intent.ACTION_SEND) ;
Emailintent.putExtra(android.content.Intent.EXTRA_EMAIL, to);
Emailintent.setType("plain/text");
Emailintent.putExtra(android.content.Intent.EXTRA_TEXT, message);
Emailintent.putExtra(android.content.Intent.EXTRA_TEXT, message2);
Emailintent.putExtra(android.content.Intent.EXTRA_TEXT, message3);
Emailintent.putExtra(android.content.Intent.EXTRA_TEXT, message4);
startActivity(Emailintent);
}
private void convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated() {
// TODO Auto-generated method stub
email2= youremail.getText().toString();
mobile = yourmobile.getText().toString();
name = yourname.getText().toString();
question = yourquestion.getText().toString();
}