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.

Sentry mobile image

Improving mobile performance, from slow screens to app start time

Based on our experience working with thousands of mobile developer teams, we developed a mobile monitoring maturity curve.

Read more

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post