spring-email

Java API to send emails in Spring

Лицензия

Лицензия

Категории

Категории

Kotlin Языки программирования
Группа

Группа

com.github.migangqui
Идентификатор

Идентификатор

spring-email-api-kotlin
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

spring-email
Java API to send emails in Spring
Ссылка на сайт

Ссылка на сайт

https://github.com/migangqui/spring-email-api
Система контроля версий

Система контроля версий

https://github.com/migangqui/spring-email-api

Скачать spring-email-api-kotlin

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.migangqui/spring-email-api-kotlin/ -->
<dependency>
    <groupId>com.github.migangqui</groupId>
    <artifactId>spring-email-api-kotlin</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.migangqui/spring-email-api-kotlin/
implementation 'com.github.migangqui:spring-email-api-kotlin:1.0.1'
// https://jarcasting.com/artifacts/com.github.migangqui/spring-email-api-kotlin/
implementation ("com.github.migangqui:spring-email-api-kotlin:1.0.1")
'com.github.migangqui:spring-email-api-kotlin:jar:1.0.1'
<dependency org="com.github.migangqui" name="spring-email-api-kotlin" rev="1.0.1">
  <artifact name="spring-email-api-kotlin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.migangqui', module='spring-email-api-kotlin', version='1.0.1')
)
libraryDependencies += "com.github.migangqui" % "spring-email-api-kotlin" % "1.0.1"
[com.github.migangqui/spring-email-api-kotlin "1.0.1"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-mail jar 2.2.5.RELEASE
com.fasterxml.jackson.core : jackson-annotations jar 2.9.8
commons-io : commons-io jar 2.5
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.71
org.jetbrains.kotlin : kotlin-reflect jar 1.3.71
io.github.microutils : kotlin-logging jar 1.6.10

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.16.18

test (1)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-test jar 1.3.71

Модули Проекта

Данный проект не имеет модулей.

Spring Email API (Java/Kotlin)

It is an API for Java and Kotlin to send emails with Spring. To add to the project, only do this things.

Add dependency to pom.xml

For Java:

<dependency>
	<groupId>com.github.migangqui</groupId>
	<artifactId>spring-email-api-java</artifactId>
	<version>${currentVersion}</version>
</dependency>

For Kotlin:

<dependency>
	<groupId>com.github.migangqui</groupId>
	<artifactId>spring-email-api-kotlin</artifactId>
	<version>${currentVersion}</version>
</dependency>

${currentVersion} is 1.0.1

Add the following properties in application.yml of the project

spring:
  mail:
    default-encoding: UTF-8
    host: # for example: smtp.gmail.com
    username: # Your email
    password: # Your email pass
    port: # SMPT port, for exaple: 25, 587
    properties:
      mail:
        transport.protocol: smtp
# Optional properties
#        smtp:
#          ssl:
#            trust: '*'
#          auth: true
#          starttls:
#            enable: true
#            required: true

Enable async

Add @EnableAsync annotation in your Spring Application class to enable async send method.

Component scan

It's not neccesary add the package to component scan with this new version.

How to use

You have to inject EmailService as dependency in your Spring component. The service provide these methods:

Java
public interface EmailService {
    SendEmailResult send(Email emailDTO);
        
    Future<SendEmailResult> sendAsync(Email emailDTO);
}
Kotlin
interface AmazonS3Service {
    fun send(email: Email): SendEmailResult

    fun sendAsync(email: Email): Future<SendEmailResult>
}

Версии библиотеки

Версия
1.0.1
1.0.0