0

I am using the code mentioned here: Sending Email in Android using JavaMail API without using the default/built-in app

This is my code. When the user reaches a specific point the mail should be automatically sent but it's not happening. Permissions are perfect.

if (User.TOTAL_POINTS >= 2) {
    try { 

        Mail m = new Mail("rubypawa1@gmail.com", "my password"); 

        String[] toArr = {"suvinay123@gmail.com", "rubypawa1@gmail.com.com"}; 
        m.setTo(toArr); 
        m.setFrom("rubypawa1@gmail.com"); 
        m.setSubject("This is an email sent using my Mail JavaMail wrapper from an Android device."); 
        m.setBody("Email body."); 

        if(m.send()) { 
            Toast.makeText(MyActivity.this, "Email was sent successfully.", Toast.LENGTH_LONG).show(); 
        } else { 
            Toast.makeText(MyActivity.this, "Email was not sent.", Toast.LENGTH_LONG).show(); 
        } 
    } catch(Exception e) { 
        //Toast.makeText(MailApp.this, "There was a problem sending the email.", Toast.LENGTH_LONG).show(); 
        Log.e("MailApp", "Could not send email", e); 
    } 
} 
Community
  • 1
  • 1

0 Answers0