All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ag.orbia.common.infrastructure.email.SesConfig.kt Maven / Gradle / Ivy

package ag.orbia.common.infrastructure.email

import com.amazonaws.auth.AWSCredentialsProvider
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
import com.amazonaws.services.simpleemail.AmazonSimpleEmailService
import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
open class SesConfig {

    @Value("\${notifications.email.region:us-east-1}")
    private lateinit var sesRegion: String

    @Bean
    open fun getAmazonEmailClient(): AmazonSimpleEmailService {
        val provider: AWSCredentialsProvider = DefaultAWSCredentialsProviderChain()

        return AmazonSimpleEmailServiceClientBuilder.standard()
            .withRegion(sesRegion)
            .withCredentials(provider)
            .build()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy