How to make a form on android and send the information to an email?

2

Hello I am creating an android app and I want to create a contact form that was sent to my mail I would like you to help me I am new to this. thank you very much

    
asked by user13915 05.09.2016 в 22:43
source

1 answer

2

This is a way to make the shipment:

 Log.i("Send email", "");
  String[] TO = {"[email protected]"};
  String[] CC = {"[email protected]"};
  Intent emailIntent = new Intent(Intent.ACTION_SEND);

  emailIntent.setData(Uri.parse("mailto:"));
  emailIntent.setType("text/plain");
  emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
  emailIntent.putExtra(Intent.EXTRA_CC, CC);
  emailIntent.putExtra(Intent.EXTRA_SUBJECT, "encabezado");
  emailIntent.putExtra(Intent.EXTRA_TEXT, "[email protected]");

  try {
     startActivity(Intent.createChooser(emailIntent, "Enviando Email..."));
     Log.i("termina envio de email...", "");
  }
  catch (android.content.ActivityNotFoundException ex) {
     Toast.makeText(MainActivity.this, "No existe cliente Email instalado.", Toast.LENGTH_SHORT).show();
  }

For your form, you can create a view with several EditText in which you write the necessary values.

Here is an example in Spanish:

link

    
answered by 05.09.2016 в 22:48