{"id":21646599,"url":"https://github.com/skn437/skn-spring-mail","last_synced_at":"2026-01-29T23:32:22.019Z","repository":{"id":226491093,"uuid":"768490083","full_name":"skn437/skn-spring-mail","owner":"skn437","description":"A Simple Mail Service Library For Java Reactive Spring Boot","archived":false,"fork":false,"pushed_at":"2024-12-04T11:10:01.000Z","size":161,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T16:51:12.450Z","etag":null,"topics":["gradle","java","library","mail","maven","spring-boot"],"latest_commit_sha":null,"homepage":"https://javadoc.io/doc/best.skn/skn-spring-mail/latest/index.html","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skn437.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-07T07:17:58.000Z","updated_at":"2024-12-09T19:54:55.000Z","dependencies_parsed_at":"2024-03-17T22:29:12.451Z","dependency_job_id":"e965e8f5-5d5b-4bcd-9d2d-a4c1309e3a35","html_url":"https://github.com/skn437/skn-spring-mail","commit_stats":null,"previous_names":["skn437/skn-spring-mail"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/skn437/skn-spring-mail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skn437%2Fskn-spring-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skn437%2Fskn-spring-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skn437%2Fskn-spring-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skn437%2Fskn-spring-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skn437","download_url":"https://codeload.github.com/skn437/skn-spring-mail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skn437%2Fskn-spring-mail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28890349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","java","library","mail","maven","spring-boot"],"created_at":"2024-11-25T06:45:48.748Z","updated_at":"2026-01-29T23:32:22.002Z","avatar_url":"https://github.com/skn437.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SKN Reactive Spring Boot Mail Library\n\n\u003cimg width=\"150px\" src=\"https://firebasestorage.googleapis.com/v0/b/skn-ultimate-project-la437.appspot.com/o/GitHub%20Library%2F04-Spring%20Boot-SSM.svg?alt=media\u0026token=52fedfd3-921c-413b-992c-db9d84eecd2e\" alt=\"java\" /\u003e\n\n\u003e Java\n\n[![Maven Central](https://img.shields.io/maven-central/v/best.skn/skn-spring-mail)](https://central.sonatype.com/artifact/best.skn/skn-spring-mail) [![Javadoc](https://javadoc.io/badge2/best.skn/skn-spring-mail/2.4.0/javadoc.svg)](https://javadoc.io/doc/best.skn/skn-spring-mail/2.4.0) [![Apache License 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\u0026nbsp;\n\n## **_JavaDocs:_**\n\n### Read the Javadoc for the main Service APIs\n\n- [MailSenderService API](https://javadoc.io/doc/best.skn/skn-spring-mail/latest/best/skn/mail/services/MailSenderService.html)\n- [MailSenderRequestInfo API](https://javadoc.io/doc/best.skn/skn-spring-mail/latest/best/skn/mail/models/MailSenderRequestInfo.html)\n- [MailSenderInputStream API](https://javadoc.io/doc/best.skn/skn-spring-mail/latest/best/skn/mail/models/MailSenderInputStream.html)\n- [MailSenderHtmlTemplate API](https://javadoc.io/doc/best.skn/skn-spring-mail/latest/best/skn/mail/models/MailSenderHtmlTemplate.html)\n\n\u0026nbsp;\n\n## **_Introduction:_**\n\n### This is a simple Java Reactive Spring Boot Library for sending mails\n\n### I made this library so that I can use it in most of my spring boot reactive projects without writing the same codes over and over again\n\n### The main API Classes of this library are `MailSenderService` which has 4 methods to send mails, `MailSenderRequestInfo` which holds the blueprint for `@RequestBody/@RequestPart` annotated params, `MailSenderInputStream` which holds the blueprint for processing proper input stream info \u0026 `MailSenderHtmlTemplate` which holds the blueprint for processing proper thymeleaf HTML template info. These APIs are for controllers\n\n\u0026nbsp;\n\n## **_Details:_**\n\n### **(1) `MailSenderService` Class:**\n\n- It needs to be instantiated first\n- It must be used in controller POST requests\n- It has 4 methods to send mails\n- These 4 methods throw `MessagingException` if sending error occurs\n- 2 methods out of 4 also throw `IOException` if file attachment error occurs\n- The modes to send mails:\n  - Basic Mail (It throws `MessagingException`)\n  - Basic Mail With Attachment (It throws `MessagingException` \u0026 `IOException`)\n  - Mail With HTML Template (It throws `MessagingException`)\n  - Mail With HTML Template \u0026 Attachment (It throws `MessagingException` \u0026 `IOException`)\n\n### **(2) `MailSenderRequestInfo` Class:**\n\n- It is the blueprint for `@RequestBody/@RequestPart` annotated params in controllers\n- In controller POST requests, the request body or request part must match the blueprint of it\n\n### **(3) `MailSenderInputStream` Class:**\n\n- It is the blueprint for processing proper input stream info in controllers\n- In controller POST requests, it will receive `MultipartFile` type as `@RequestPart`\n- Then this API instance should be created with the input stream\n\n### **(4) `MailSenderHtmlTemplate` Class:**\n\n- It is the blueprint for processing proper thymeleaf HTML template info in controllers\n- The project should have a Thymeleaf Html Template already\n- Then this API instance should be created with the template name and the variable name inside that template\n\n\u0026nbsp;\n\n## **_Requirements:_**\n\n- 💀 Minimum Java Version: `21`\n- 💀 Minimum Spring Boot Version: `3.3.5`\n- 💀 Spring Web Flux (Reactive Spring Boot)\n- 💀 Spring Java Mail Sender\n- 💀 Spring Thymeleaf\n\n\u0026nbsp;\n\n## **_Usage:_**\n\n### For `Maven`, inside `dependencies` tag of `pom.xml`, copy the following\n\n\u003e ```xml\n\u003e \u003cdependency\u003e\n\u003e   \u003cgroupId\u003ebest.skn\u003c/groupId\u003e\n\u003e   \u003cartifactId\u003eskn-spring-mail\u003c/artifactId\u003e\n\u003e   \u003cversion\u003e2.4.0\u003c/version\u003e\n\u003e \u003c/dependency\u003e\n\u003e ```\n\n### For `Gradle`, inside `dependencies` block of `build.gradle.kts`, copy the following\n\n\u003e ```kotlin\n\u003e implementation(\"best.skn:skn-spring-mail:2.4.0\")\n\u003e ```\n\n### First create a configuration class\n\n\u003e ```java\n\u003e import best.skn.mail.configurations.MailSenderConfiguration;\n\u003e\n\u003e @Configuration\n\u003e @Import(MailSenderConfiguration.class)\n\u003e public class MailSenderSpringConfiguration {}\n\u003e ```\n\n### Inside your Java Code, import the package like this for `MailSenderService`\n\n\u003e ```java\n\u003e import best.skn.mail.services.MailSenderService;\n\u003e ```\n\n### Inside your Java Code, import the package like this for `MailSenderRequestInfo`, `MailSenderInputStream` \u0026 `MailSenderHtmlTemplate`\n\n\u003e ```java\n\u003e import best.skn.mail.models.*;\n\u003e ```\n\n### In controller POST requests, use it like the following (Just an example)\n\n\u003e ```java\n\u003e @Autowired\n\u003e private MailSenderService mailSender;\n\u003e\n\u003e @PostMapping(\"/endpoint-for-basic-mail\")\n\u003e public Mono\u003cString\u003e sendMail(@RequestBody MailSenderRequestInfo info)\n\u003e throws MessagingException {\n\u003e   return this.mailSender.sendMail(info);\n\u003e }\n\u003e\n\u003e @PostMapping(\"/endpoint-for-mail-with-attachment\")\n\u003e public Mono\u003cString\u003e sendMailWithAttachment(\n\u003e   @RequestPart MailSenderRequestInfo info,\n\u003e   @RequestPart MultipartFile file\n\u003e ) throws MessagingException, IOException {\n\u003e   MailSenderInputStream stream = new MailSenderInputStream(\n\u003e     \"output file location here\",\n\u003e     file.getInputStream()\n\u003e   );\n\u003e\n\u003e   return this.mailSender.sendMailWithAttachment(info, stream);\n\u003e }\n\u003e\n\u003e @PostMapping(\"/endpoint-for-mail-with-html-template\")\n\u003e public Mono\u003cString\u003e sendMailWithHtmlTemplate(\n\u003e   @RequestBody MailSenderRequestInfo info\n\u003e ) throws MessagingException {\n\u003e   // you must have \"mail.html\" in `resources/templates` and the template must have a `message` variable\n\u003e   MailSenderHtmlTemplate template = new MailSenderHtmlTemplate(\n\u003e     \"mail.html\",\n\u003e     \"message\"\n\u003e   );\n\u003e\n\u003e   return this.mailSender.sendMailWithHtmlTemplate(info, template);\n\u003e }\n\u003e\n\u003e @PostMapping(\"/endpoint-for-mail-with-html-template-and-attachment\")\n\u003e public Mono\u003cString\u003e sendMailWithHtmlTemplateAndAttachment(\n\u003e   @RequestPart MailSenderRequestInfo info,\n\u003e   @RequestPart MultipartFile file\n\u003e ) throws MessagingException, IOException {\n\u003e   // you must have \"mail.html\" in `resources/templates` and the template must have a `message` variable\n\u003e   MailSenderHtmlTemplate template = new MailSenderHtmlTemplate(\n\u003e     \"mail.html\",\n\u003e     \"message\"\n\u003e   );\n\u003e\n\u003e   MailSenderInputStream stream = new MailSenderInputStream(\n\u003e     \"output file location here\",\n\u003e     file.getInputStream()\n\u003e   );\n\u003e\n\u003e   return this.mailSender.sendMailWithHtmlTemplateAndAttachment(info, template, stream);\n\u003e }\n\u003e ```\n\n### When requesting the API from `Postman` or `Frontend Framework` for mails without attachment, the request body `json` format can be like the following-\n\n\u003e ```json\n\u003e {\n\u003e   \"from\": \"sender email address\",\n\u003e   \"to\": \"receiver email address\",\n\u003e   \"subject\": \"mail subject\",\n\u003e   \"body\": \"mail body\"\n\u003e }\n\u003e ```\n\n### When requesting the API from `Postman` or `Frontend Framework` for mails with attachment, the request should be made with `form-data` format as it will be processed with `@RequestPart`\n\n\u0026nbsp;\n\n## **_Dedicated To:_**\n\n- 👩‍🎨`Prodipta Das Logno` \u0026 🧛‍♀️`Atoshi Sarker Prithula`: The two most special ladies of my life. My best wishes will always be with you two. May you two always be happy.\n- 💯`My Parents`: The greatest treasures of my life ever.\n\n\u0026nbsp;\n\n## **_License:_**\n\nCopyright (C) 2024 SKN Shukhan\n\nLicensed under the Apache License, Version 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskn437%2Fskn-spring-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskn437%2Fskn-spring-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskn437%2Fskn-spring-mail/lists"}