gmail-sender-helper icon indicating copy to clipboard operation
gmail-sender-helper copied to clipboard

This library help you to sent email to gmail

This library help you to sent email by gmail

Android Arsenal

Download

Setup

  1. Add to build.gradle in app level
implementation 'com.github.tntkhang:gmail-sender-library:1.3.0'
  1. How to use it
   GMailSender.withAccount("[email protected]", "email-password")
                .withTitle(title)
                .withBody(body)
                .withSender(getString(R.string.app_name))
                .toEmailAddress(emailAddress) // one or multiple addresses separated by a comma
                .withListenner(new GmailListener() {
                    @Override
                    public void sendSuccess() {
                        Toast.makeText(MainActivity.this, "Success", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void sendFail(String err) {
                        Toast.makeText(MainActivity.this, "Fail: " + err, Toast.LENGTH_SHORT).show();
                    }
                })
                .send();
  1. IMPORTANT ! Enable less secure for the email using to sent email: https://support.google.com/accounts/answer/6010255?hl=en
  2. Add those line into pro-guard
# Required for GmailSender
-dontwarn java.awt.**
-dontwarn java.beans.Beans
-dontwarn javax.security.**
-keep class javamail.** {*;}
-keep class javax.mail.** {*;}
-keep class javax.activation.** {*;}
-keep class com.sun.mail.dsn.** {*;}
-keep class com.sun.mail.handlers.** {*;}
-keep class com.sun.mail.smtp.** {*;}
-keep class com.sun.mail.util.** {*;}
-keep class mailcap.** {*;}
-keep class mimetypes.** {*;}
-keep class myjava.awt.datatransfer.** {*;}
-keep class org.apache.harmony.awt.** {*;}
-keep class org.apache.harmony.misc.** {*;}
  1. Enjoy

Checkout example if you need a demo.