nedimf / maildroid

Maildroid is a small robust android library for sending emails using SMTP server
188 stars 24 forks source link
gradle javamail-api jitpack kotlin kotlin-android robust-android-library smtp-server


nedimfakic.com
Maildroid

:tada: Maildroid is a small robust android library for sending emails using SMTP server :tada:

Android Arsenal


JitPack Reddit Twitter Follow

Key FeaturesAdd to your projectDocumentationShowcaseDevelopmentFAQ

Latest active version is v0.1.1-release
Library status: ACTIVE

screenshot Library is using Oracle Java Mail API to handle connections and sending emails.

Key Features

Add to your project

Maildroid is hosted on JitPack and it's quite easy to integrate in to your project. Maildroid requires at least Android API level 19 Android KitKat

How do you want to integrate Maildroid into your project

Gradle

Add this to your root.gradle file ```gradle allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` Add dependency ```gradle dependencies { implementation 'com.github.nedimf:maildroid:v0.1.1-release' } ```

Maven

Add the JitPack repository to your build file ``` jitpack.io https://jitpack.io ``` Add the dependency ```maven com.github.nedimf maildroid v0.1.1-release ```

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("")
            .port("")
            .type(MaildroidXType.HTML)
            .to("")
            .from("")
            .subject("")
            .body("")
            .attachment()
        .isJavascriptDisabled()
        .isisStartTLSEnabled()
        //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


Documentation for version v.0.0.4

Errors


Maildroid is handling small amount of exceptions.

IllegalArgumentException
These exceptions are called after an error in checking if mandatory fields are not existent.

AuthenticationFailedException
These exceptions are called when username or password on SMTP server is not correct, or address of SMTP server is not existent.

Other

Proguard

-keep class org.apache.** { *; }
-dontwarn org.apache.**

-keep class com.sun.mail.** { *; }
-dontwarn com.sun.mail.**

-keep class java.beans.** { *; }
-dontwarn java.beans.**

Development

We love open source :hearts:
Contributing to our project is really easy if you follow these steps.

Bug :bug:


We are trying to make this library as bug free as possible ,but as you know some bugs can occure. If you find bug or typo in our library be free to open issue and report it.

Feature Request


We strive to make maildroid best mailing library out there. We have ideas to add, but we would also like to hear from you.

Built with :muscle:


TODO


Team

nedimf javier-moreno

Your name here :hearts:

Motivation

Maildroid was born from the frustration of implementing a good emailing solution I had while developing a few client apps. I had to do many hours of unneeded work to make some emailing functions work using old libraries. Those libraries were limited to one SMTP server and because of that frustration Maildroid was born..

Showcase

FAQ

HitCount Gitter Say Thanks!

This part will grow more over time as question are posted.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Designer credits

Icon made by Designer & Freepik from flaticon