Maildroid is a small robust android library for sending emails using SMTP server
Key Features • Add to your project • Documentation • Showcase • Development • FAQ
Latest active version is v0.0.6
Library status: ACTIVE
Library is using Oracle Java Mail API to handle connections and sending emails.
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
Add this to your root.gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add dependency
dependencies {
implementation 'com.github.nedimf:maildroid:v0.0.6-release'
}
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.6-release</version>
</dependency>
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 .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("[email protected]") from("[email protected]") subject("Hello!") body("email body") attachment("path_to_file/file.txt") //or attachments() //List callback { timeOut(3000) onSuccess { Log.d("MaildroidX", "SUCCESS") } onFail { Log.d("MaildroidX", "FAIL") } } }
from version v0.0.3 it containes errorMessage (String)> - timeout value that is used to predict timout how long will it take for email to be sent defualt is 3 seconds (Long)
Maildroid is handling small amount of exceptions.
IllegalArgumentException
These exceptions are called after an error in checking if mandatory fields are not existent.
-
MaildroidX detected that you didn't pass [smtp] value in to the builder!-
MaildroidX detected that you didn't pass [smtpAuthentication] value to the builder!-
MaildroidX detected that you didn't pass [port] value to the builder!
AuthenticationFailedException
These exceptions are called when username or password on SMTP server is not correct, or address of SMTP server is not existent.
-
MaildroidX detected that you didn't pass [smtpUsername] or [smtpPassword] to the builder!-
MaildroidX detected that you didn't pass [smtpUsername] or [smtpPassword] to the builder!
Other -
SMTPAddressFailedException
Thrown when mail can't be sent -
MessagingExceptionThrown when there is problem with message -IOExceptionFile in attachment not found or not existent
-keep class org.apache.** { *; } -dontwarn org.apache.**-keep class com.sun.mail.** { *; } -dontwarn com.sun.mail.**
-keep class java.beans.** { *; } -dontwarn java.beans.**
We love open source :hearts:
Contributing to our project is really easy if you follow these steps.
Add
maildroidxto your machine
Contribution :tada:
git checkout -b maildroidx-community-features
git commit -m 'New feature'
git push origin maildroidx-community-features
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. - Open issue - bug
Explaining bug is most important thing please use standard english language and don't forget to share your debug log - typo
We strive to make
maildroidbest mailing library out there. We have ideas to add, but we would also like to hear from you. - Open issue - fetaure
nedimf | javier-moreno |
Your name here :hearts:
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
Maildroidwas born..
How to use Google
gmailsmtp server
As stated above every smtp server that uses SSL should be supported.
Tutorial how to usesmtp.gmail.com:
smtp.("smtp.gmail.com")
smtpUsername.("")your gmail email adress
smtpPassword.("")your gmail password
smtpPort.("465")gmail SSL port
How to test sending emails,but not to affect client
Maildroid works great with mailtrap.io. They limit 50 message per inbox.Inbox can be erase at any time what it makes it one of the best solution for developers.
Do this library save any of those data to external parties or servers?
Maildroid is open source and it DOES NOT save ANY data to extarnal servers or parties.
Do this library needs AndroidX to run properly?
Yes,project needs to be compatible with AndroidX QUICK GUIDE
This part will grow more over time as question are posted.
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.