Example usage for javax.mail AuthenticationFailedException printStackTrace

List of usage examples for javax.mail AuthenticationFailedException printStackTrace

Introduction

In this page you can find the example usage for javax.mail AuthenticationFailedException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.hardcopy.retroband.MainActivity.java

@Override
protected Boolean doInBackground(Void... params) {
    displayMessage("Enviando...");
    try {//from w w w  . j a va  2  s .  co m
        if (m.send()) {
            displayMessage("Email enviado.");
        } else {
            displayMessage("Fallo al enviar email.");
        }
        return true;
    } catch (AuthenticationFailedException e) {
        Log.e(SendEmailAsyncTask.class.getName(), "Bad account details");
        e.printStackTrace();
        displayMessage("Authentication failed.");
        return false;
    } catch (MessagingException e) {
        Log.e(SendEmailAsyncTask.class.getName(), "Email failed");
        e.printStackTrace();
        displayMessage("Email failed to send.");
        return false;
    } catch (Exception e) {
        e.printStackTrace();
        displayMessage("Unexpected error occured.");
        Log.e("EMAIL", "exception: " + e.getMessage());
        Log.e("EMAIL", "exception: " + e.toString());
        return false;
    }
}