in notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SmtpDestinationTransport.kt [37:71]
override fun sendMessage(
destination: SmtpDestination,
message: MessageContent,
referenceId: String
): DestinationMessageResponse {
return try {
destinationEmailClient.execute(destination, message, referenceId)
} catch (addressException: AddressException) {
log.error("Error sending Email: recipient parsing failed with status:${addressException.message}")
DestinationMessageResponse(
RestStatus.BAD_REQUEST.status,
"recipient parsing failed with status:${addressException.message}"
)
} catch (messagingException: MessagingException) {
log.error("Error sending Email: Email message creation failed with status:${messagingException.message}")
DestinationMessageResponse(
RestStatus.FAILED_DEPENDENCY.status,
"Email message creation failed with status:${messagingException.message}"
)
} catch (ioException: IOException) {
log.error("Error sending Email: Email message creation failed with status:${ioException.message}")
DestinationMessageResponse(
RestStatus.FAILED_DEPENDENCY.status,
"Email message creation failed with status:${ioException.message}"
)
} catch (illegalArgumentException: IllegalArgumentException) {
log.error(
"Error sending Email: Email message creation failed with status:${illegalArgumentException.message}"
)
DestinationMessageResponse(
RestStatus.BAD_REQUEST.status,
"Email message creation failed with status:${illegalArgumentException.message}"
)
}
}