Skip to content

Gotham25/TurboSMTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TurboSMTP

Kotlin library to send mail using Turbo SMTP API This is a wrapper for the web API provided by serversmtp mentioned here.

To use this module you have to have account at http://serversmtp.com . Basic account is free of charge

Version

1.0.0-RELEASE

Installation

Gradle

<dependency>
    <groupId>com.github.gotham25</groupId>
    <artifactId>TurboSMTP</artifactId>
    <version>1.0.0-RELEASE</version>
    <type>pom</type>
</dependency>

Maven

compile group: 'com.github.gotham25', name: 'TurboSMTP', version: '1.0.0-RELEASE'

(or)

implementation 'com.github.gotham25:TurboSMTP:1.0.0-RELEASE'

Usage

In Java

  TurboMailer mailer = new TurboMailer.Builder()
                          .AuthUser(TURBO_SMTP_AUTH_USERNAME)
                          .AuthPass(TURBO_SMTP_AUTH_PASSWORD)
                          .build();
  String mailResponse = mailer.sendMail(
                                FROM_EMAIL_ADDRESS,
                                TO_EMAIL_ADDRESS,
                                SUBJECT,
                                CC,
                                BCC,
                                TEXT_EMAIL_BODY,
                                HTML_EMAIL_BODY, //html_content
                                CUSTOM_HEADERS,
                                MIME_RAW);

In Kotlin

val mailer = TurboMailer.Builder()
                          .AuthUser(TURBO_SMTP_AUTH_USERNAME)
                          .AuthPass(TURBO_SMTP_AUTH_PASSWORD)
                          .build();
                          
val mailResponse = mailer.sendMail(
                                FROM_EMAIL_ADDRESS,
                                TO_EMAIL_ADDRESS,
                                SUBJECT,
                                CC,
                                BCC,
                                TEXT_EMAIL_BODY,
                                HTML_EMAIL_BODY,
                                CUSTOM_HEADERS,
                                MIME_RAW);

All responses will be as JSON string mentioned in the API doc for a successfull status(i.e 200) For the rest of responses it's be as JSON response in below format,

{
	"error": error_mesage,
	"errorCode": error_code
}

where error_message is a string and error_code is a integer indicating a statusCode for the response.

About

Kotlin library to send mail using Turbo SMTP API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages