DEV Community

Nedim
Nedim

Posted on

3 2

Maildroid

How to send email in Android

Sending email in android is not really an easy task, but with using Maildroid library it takes seconds

Library
https://github.com/nedimf/maildroid/

Libary got great attraction on r/androiddev so here it is how it works ♥️

Start


Add this to your root.gradle file

allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

Add dependency


dependencies {
            implementation 'com.github.nedimf:maildroid:0.0.1'
          }

Adding Maildroid to your app

  MaildroidX.Builder()
            .smtp("") //Add your smtp provider
            .smtpUsername("") 
            .smtpPassword("")
            .smtpAuthentication() //true
            .port("")
            .type(MaildroidX.HTML) //Type of email
            .to("")
            .from("")
            .subject("")
            .body("")
            .onCompleteCallback(object : MaildroidX.onCompleteCallback{
                override fun onSuccess() {
                    //Place for your code when email is sent successfully!
                }
                override fun onFail() {
                   //Place for your code when email is not sent!
                }
            },3000)
            .mail()

Testing

Create account on [mailtrap](https://mailtrap.io/ to test your emails. T
Add username and password in those constructor field.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more