Advertisement
Sketchware

Manda email usando edittext

Jan 17th, 2023
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. String to = EditText1.getText().toString();
  2. String subject = EditText2.getText().toString();
  3. String message = EditText3.getText().toString();
  4.  
  5. Intent email = new Intent(Intent.ACTION_SEND);
  6. email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});
  7. email.putExtra(Intent.EXTRA_SUBJECT, subject);
  8. email.putExtra(Intent.EXTRA_TEXT, message);
  9.  
  10. // precisa configurar tipo de email
  11. email.setType("message/rfc822");
  12.  
  13. startActivity(Intent.createChooser(email, "Selecione um App de email :"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement