How do I know if the email was actually sent?

Asked

Viewed 157 times

2

I’m using a code to send email, call the email sending service and choose a particular email that is already configured on the mobile. Everything is working normally, but I want to put one Alert after sending this email but I can not display at the right time, because I do not have a positive or negative response to the sending of this email. How do I know the email was actually sent? Follow my code...

                Intent sendEmail = new Intent(Intent.ACTION_SEND);
                sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
                sendEmail.putExtra(Intent.EXTRA_SUBJECT, assunto);
                sendEmail.putExtra(Intent.EXTRA_CC, new String[]{email});
                sendEmail.putExtra(Intent.EXTRA_STREAM, imageUri);
                sendEmail.putExtra(Intent.EXTRA_TEXT, "texto...");

                sendEmail.setType("message/rfc822");

                startActivity(Intent.createChooser
                     (sendEmail, "Enviar o e-mail com: "));

                AlertDialog.Builder alert = new AlertDialog.Builder(activity);
                alert.setTitle("Obrigado pelo contato !");
                alert.setMessage("texto...");
                alert.setPositiveButton("OK", null);
                alert.show();
  • This code can help you http://stackoverflow.com/questions/5471217/trivial-get-confirmation-of-email-sent-in-android

1 answer

1

The responsibility of informing if the email was sent or not is from the Activity that your client invoked. Therefore there is no need for you to deal with the success case or error of sending the email. It itself will inform the user if the action is not completed successfully.

  • 1

    Yes I agree with you, but in this project I am obliged to put this feedback to the user. it will be possible to receive some kind of result from this Activity ?

  • 1

    Only if I give you that information. And if this is the case, the way to get this information will be in the documentation of this Activity (developer’s website)

  • 1

    I already researched a lot about this and did not find, because I invoke an application (closed) that sends email it does not return me a true or false of the send, because in this case I become dependent on the other app.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.