{"id":23122731,"url":"https://github.com/folio-org/mod-email","last_synced_at":"2025-08-17T02:31:10.793Z","repository":{"id":33410664,"uuid":"153640400","full_name":"folio-org/mod-email","owner":"folio-org","description":"Provides functionality for sending notifications","archived":false,"fork":false,"pushed_at":"2025-03-20T01:54:56.000Z","size":330,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-04T23:11:11.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"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/folio-org.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","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":"2018-10-18T14:45:43.000Z","updated_at":"2025-03-14T12:48:22.000Z","dependencies_parsed_at":"2023-02-14T09:35:36.316Z","dependency_job_id":"3cee5a1c-1508-41f1-9dc3-799d747ea9ae","html_url":"https://github.com/folio-org/mod-email","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/folio-org/mod-email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folio-org%2Fmod-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folio-org%2Fmod-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folio-org%2Fmod-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folio-org%2Fmod-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folio-org","download_url":"https://codeload.github.com/folio-org/mod-email/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folio-org%2Fmod-email/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270798893,"owners_count":24648047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-17T07:30:04.548Z","updated_at":"2025-08-17T02:31:10.521Z","avatar_url":"https://github.com/folio-org.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mod-email\n\nCopyright (C) 2018-2023 The Open Library Foundation\n\nThis software is distributed under the terms of the Apache License,\nVersion 2.0. See the file \"[LICENSE](LICENSE)\" for more information.\n\n\u003c!-- ../../okapi/doc/md2toc -l 2 -h 4 README.md --\u003e\n\n## Goal\n\n`mod-email` provides an API for delivering email messages.\n\n## Configuration\nFor email delivery `mod-email` relies on the external SMTP server,\nconfiguration for which is stored by `mod-email` in its own database.\nThe module also provides CRUD API for managing it.\nIf `mod-email` couldn't find SMTP configuration in its own DB, it'll try to\nfetch one from`mod-configuration`, copy it to the DB and then delete it from\n`mod-configuration`.\n\n### Supported configuration parameters\n\n| mod-email parameter | mod-configuration parameter | DESCRIPTION                                                                                                               | EXAMPLES                       |\n|---------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------------------------|\n| host                | EMAIL_SMTP_HOST             | the hostname of the smtp server                                                                                           | 'localhost'                    |\n| port                | EMAIL_SMTP_PORT             | the port of the smtp server                                                                                               | 502                            |\n| loginOption         | EMAIL_SMTP_LOGIN_OPTION     | the login mode for the connection                                                                                         | DISABLED, OPTIONAL or REQUIRED |\n| trustAll            | EMAIL_TRUST_ALL             | trust all certificates on ssl connect                                                                                     | true or false                  |\n| ssl                 | EMAIL_SMTP_SSL              | sslOnConnect mode for the connection                                                                                      | true or false                  |\n| startTlsOptions     | EMAIL_START_TLS_OPTIONS     | TLS security mode for the connection                                                                                      | DISABLED, OPTIONAL or REQUIRED |\n| username            | EMAIL_USERNAME              | the username for the login                                                                                                | 'login'                        |\n| password            | EMAIL_PASSWORD              | the password for the login                                                                                                | 'password'                     |\n| from                | EMAIL_FROM                  | 'from' property of the email                                                                                              | noreply@folio.org              |\n| authMethods         | AUTH_METHODS                | authentication methods                                                                                                    | 'CRAM-MD5 LOGIN PLAIN'         |\n| expirationHours         |                 | Messages which are older than expiration hours are considered as expired and gets deleted. Default value will be 24 hours | 12                             |\n\n### Configuration using `mod-email`'s API\n\nThis method of configuration is preferred.\n\nRequired configuration parameters:\n* Host\n* Port\n* User name\n* Password\n\nSMTP configuration (`GET /smtp-configuration/{id}`) example:\n```\n{\n    \"id\": \"d2db040b-3247-4b2b-8db4-5ef449e092ad\",\n    \"host\": \"example-host.com\",\n    \"port\": 587,\n    \"username\": \"example-username\",\n    \"password\": \"example-password\",\n    \"ssl\": false,\n    \"trustAll\": false,\n    \"loginOption\": \"NONE\",\n    \"startTlsOptions\": \"OPTIONAL\",\n    \"authMethods\": \"\",\n    \"from\": \"noreply@folio.org\",\n    \"emailHeaders\": [\n        {\n            \"name\": \"Reply-To\",\n            \"value\": \"noreply@folio.org\"\n        }\n    ]\n}\n```\n\nUse `GET /smtp-configuration` to get all configurations. It's forbidden to\ncreate more than one configuration, but this call helps to find the ID of\nthe configuration entry to use it in `GET`, `PUT`, `DELETE` requests.\n\n### Configuration using `mod-configuration` (deprecated)\n\nThis method of configuration is deprecated and needs to be avoided.\n\nAll SMTP configuration entries need their `module` field to be set to\n`SMTP_SERVER`.\n\nModule configuration example:\n\n ```\ncurl -X POST \\\n  http://localhost:9130/configurations/entries \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-Okapi-Tenant: \u003ctenant\u003e' \\\n  -H 'x-okapi-token: \u003ctoken\u003e' \\\n  -d\n    '{\n      \"module\": \"SMTP_SERVER\",\n      \"configName\": \"smtp\",\n      \"code\": \"EMAIL_SMTP_HOST\",\n      \"description\": \"server smtp host\",\n      \"default\": true,\n      \"enabled\": true,\n      \"value\": \"smtp.googlemail.com\"\n    }'\n ```\n\nThe example of request body with authentication methods configuration:\n\n ```\n {\n     \"module\": \"SMTP_SERVER\",\n     \"configName\": \"smtp\",\n     \"code\": \"AUTH_METHODS\",\n     \"description\": \"Authentication methods\",\n     \"default\": true,\n     \"enabled\": true,\n     \"value\": \"CRAM-MD5 LOGIN PLAIN\"\n }\n ```\n\n## API\n\nModule provides next API:\n\n| METHOD | URL                      | DESCRIPTION                                              |\n|--------|--------------------------|----------------------------------------------------------|\n| POST   | /email                   | Push email to mod-email for sending message to recipient |\n| GET    | /smtp-configuration      | Get all SMTP configurations                              |\n| GET    | /smtp-configuration/{id} | Get SMTP configuration                                   |\n| POST   | /smtp-configuration/{id} | Post SMTP configuration                                  |\n| PUT    | /smtp-configuration/{id} | Put SMTP configuration                                   |\n| DELETE | /smtp-configuration/{id} | Delete SMTP configuration                                |\n\n\n## Compiling\n\n```\n   mvn install\n```\n\nSee that it says \"BUILD SUCCESS\" near the end.\n\n## Port\n\nWhen running the jar file the module looks for the `http.port` and `port`\nsystem property variables in this order, and uses the default 8081 as fallback. Example:\n\n`java -Dhttp.port=8008 -jar target/mod-email-fat.jar`\n\nThe Docker container exposes port 8081.\n\n## Docker\nBuild the docker container with:\n\n* docker build -t mod-email .\n\nTest that it runs with:\n\n* docker run -t -i -p 8081:8081 mod-email\n\n## Installing the module\n\nFollow the guide of\n[Deploying Modules](https://github.com/folio-org/okapi/blob/master/doc/guide.md#example-1-deploying-and-using-a-simple-module)\nsections of the Okapi Guide and Reference, which describe the process in detail.\n\nFirst of all you need a running Okapi instance.\n(Note that [specifying](../README.md#setting-things-up) an explicit 'okapiurl' might be needed.)\n\n```\n   cd .../okapi\n   java -jar okapi-core/target/okapi-core-fat.jar dev\n```\n\nWe need to declare the module to Okapi:\n\n```\ncurl -w '\\n' -X POST -D -   \\\n   -H \"Content-type: application/json\"   \\\n   -d @target/ModuleDescriptor.json \\\n   http://localhost:9130/_/proxy/modules\n```\n\nThat ModuleDescriptor tells Okapi what the module is called, what services it\nprovides, and how to deploy it.\n\n## Deploying the module\n\nNext we need to deploy the module. There is a deployment descriptor in\n`target/DeploymentDescriptor.json`. It tells Okapi to start the module on 'localhost'.\n\nDeploy it via Okapi discovery:\n\n```\ncurl -w '\\n' -D - -s \\\n  -X POST \\\n  -H \"Content-type: application/json\" \\\n  -d @target/DeploymentDescriptor.json  \\\n  http://localhost:9130/_/discovery/modules\n```\n\nThen we need to enable the module for the tenant:\n\n```\ncurl -w '\\n' -X POST -D -   \\\n    -H \"Content-type: application/json\"   \\\n    -d @target/TenantModuleDescriptor.json \\\n    http://localhost:9130/_/proxy/tenants/\u003ctenant_name\u003e/modules\n```\n\n## Additional information\n\n### Issue tracker\n\nSee project [MODEMAIL](https://issues.folio.org/browse/MODEMAIL)\nat the [FOLIO issue tracker](https://dev.folio.org/guidelines/issue-tracker/).\n\n### ModuleDescriptor\n\nSee the built `target/ModuleDescriptor.json` for the interfaces that this module\nrequires and provides, the permissions, and the additional module metadata.\n\n### API documentation\n\nThis module's [API documentation](https://dev.folio.org/reference/api/#mod-email).\n\n### Code analysis\n\n[SonarQube analysis](https://sonarcloud.io/dashboard?id=org.folio%3Amod-email).\n\n### Download and configuration\n\nThe built artifacts for this module are available.\nSee [configuration](https://dev.folio.org/download/artifacts) for repository access,\nand the [Docker image](https://hub.docker.com/r/folioorg/mod-email/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolio-org%2Fmod-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolio-org%2Fmod-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolio-org%2Fmod-email/lists"}