gmail-sender-library

Additional

Language
Java
Version
N/A
Created
Nov 16, 2018
Updated
Jun 25, 2019
Owner
Khang Tran (tntkhang)
Contributor
Khang Tran (tntkhang)
1
Activity
Badge
Generate
Download
Source code
APK file

Promotion

This library help you to sent email by gmail

Setup

  1. Add to build.gradle in app level
implementation 'com.github.tntkhang:gmail-sender-library:1.2.0'
  1. How to use it
   GMailSender.withAccount("your-email@gmail.com", "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. Enjoy

Checkout example if you need a demo.