Maildroid

Additional

Language
Kotlin
Version
v0.0.3 (Aug 29, 2019)
Created
Aug 11, 2019
Updated
Sep 28, 2019
Owner
nedimf
Contributors
nedimf
javier-moreno
markwinds
3
Activity
Badge
Generate
Download
Source code
APK file

Promotion

Add dependency

dependencies {
         implementation 'com.github.nedimf:maildroid:v0.0.3'
          }

Maven

Add the JitPack repository to your build file

<repositories>
   <repository>
       <id>jitpack.io</id>
       <url>https://jitpack.io</url>
    </repository>
</repositories>

Add the dependency


<dependency>
     <groupId>com.github.nedimf</groupId>
     <artifactId>maildroid</artifactId>
     <version>v0.0.2</version>
</dependency>

Add to your app

Adding Maildroid to your app is straight forword process. Library is using Builder pattern to achieve flexebilty and easy to read wholesome implementation:

  MaildroidX.Builder()
            .smtp("")
            .smtpUsername("")
            .smtpPassword("")
            .smtpAuthentication()
            .port("")
            .type(MaildroidXType.HTML)
            .to("")
            .from("")
            .subject("")
            .body("")
            .attachment("")
     //or
     .attachments() //List<String>
     .onCompleteCallback(object : MaildroidX.onCompleteCallback{
  override val timeout: Long = 3000
  override fun onSuccess() {
     Log.d("MaildroidX",  "SUCCESS")     
  }
  override fun onFail(errorMessage: String) {
    Log.d("MaildroidX",  "FAIL")
  }
      })
      .mail()

DSL implementation:

sendEmail {
      smtp("smtp.mailtrap.io")
      smtpUsername("username")
      smtpPassword("password")
      smtpAuthentication(true)
      port("2525")
      type(MaildroidXType.HTML)
      to("johndoe@email.com")
      from("janedoen@email.com")
      subject("Hello!")
      body("email body")
      attachment("path_to_file/file.txt") 
      //or
      attachments() //List<String>
      callback {
          timeOut(3000)
          onSuccess {
              Log.d("MaildroidX",  "SUCCESS")
          }
          onFail {
              Log.d("MaildroidX",  "FAIL")
          }
      }
 }

Documentation