{"id":16015021,"url":"https://github.com/louismazel/docker-adonis-mailer","last_synced_at":"2026-05-02T06:43:42.292Z","repository":{"id":64789578,"uuid":"578215762","full_name":"LouisMazel/docker-adonis-mailer","owner":"LouisMazel","description":"Dockerized Adonis application to send e-mails in MJML","archived":false,"fork":false,"pushed_at":"2024-03-12T15:55:02.000Z","size":427,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T11:33:26.581Z","etag":null,"topics":["adonisjs","docker","mjml","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LouisMazel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-12-14T14:27:35.000Z","updated_at":"2023-11-09T13:40:40.000Z","dependencies_parsed_at":"2024-03-12T12:37:37.210Z","dependency_job_id":"d7c8bb6b-8bac-4d5f-abee-377909caca2c","html_url":"https://github.com/LouisMazel/docker-adonis-mailer","commit_stats":{"total_commits":76,"total_committers":2,"mean_commits":38.0,"dds":"0.22368421052631582","last_synced_commit":"dde4ea03d08219b551a32a9c837cd26d896e812d"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisMazel%2Fdocker-adonis-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisMazel%2Fdocker-adonis-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisMazel%2Fdocker-adonis-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisMazel%2Fdocker-adonis-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LouisMazel","download_url":"https://codeload.github.com/LouisMazel/docker-adonis-mailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247281572,"owners_count":20913195,"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","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":["adonisjs","docker","mjml","typescript"],"created_at":"2024-10-08T15:05:55.377Z","updated_at":"2026-05-02T06:43:42.265Z","avatar_url":"https://github.com/LouisMazel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-adonis-mailer\n\n\u003e Dockerized Adonis application to send e-mails with MJML\n\n## Usage\n\n### Build your docker-compose.yml\n\n`docker-compose.yml`\n\n```yml\nversion: '3.8'\n\nservices:\n  mailer:\n    restart: always\n    image: louismazel/mailer:latest # it's better to fix the version - louismazel/mailer:v1.2.9\n    ports:\n      - 3333:3333 # or PORT choosen\n    env_file:\n      - .env\n    # optional\n    volumes:\n      - ./src/emails:/app/resources/views/templates\n```\n\n### Environment variables file\n\n`.env`\n\n```env\nPORT=\u003cport\u003e # required\nHOST=\u003chost\u003e # default 0.0.0.0\n\nCORS_ORIGIN=\u003callowed_cors_origin\u003e # optional - string only - if not provided, only the current origin where the image is running is allowed\n\nMAIL_DRIVER=\u003cmail_driver\u003e # required - mailgun or smtp\n\n# if you choose  MAIL_DRIVER=smtp\nSMTP_HOST=\u003csmtp_host\u003e\nSMTP_PORT=\u003csmtp_port\u003e\nSMTP_SECURE=\u003csmtp_port\u003e # boolean\nSMTP_USERNAME=\u003csmtp_username\u003e\nSMTP_PASSWORD=\u003csmtp_password\u003e\n\n# if you choose  MAIL_DRIVER=mailgun\nMAILGUN_API_KEY=\u003cmailgun_api_key\u003e # optional\nMAILGUN_DOMAIN=\u003cmailgun_domain\u003e # optional\nMAILGUN_BASE_URL=\u003cmailgun_base_url\u003e # optional\n\n# default value for e-mails - can be set or override in request body\nSENDER_MAIL=\u003csender_mail\u003e # optional\nSENDER_NAME=\u003csender_name\u003e # optional\nREPLY_TO_MAIL=\u003creply_to_mail\u003e # optional\nREPLY_TO_NAME=\u003creply_to_name\u003e # optional\n```\n\n#### CORS Origin configuration\n\nYou can control the origins to allow for the CORS request using the CORS_ORIGIN environment variables.\nThis property controls [the Access-Control-Allow-Origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin) header.\n\nShould be a string, examples:\n\n- `*` - _Allow all origin_\n- `*.example.com` - _Allow all subdomain of example.com_\n- `example.com` - _Allow only requests from exemple.com_\n- `example-1.com,example-2.com` - _Allow requests from example-1.com and example-2.com_\n- etc...\n\n[Adonis documentation - Allowed origin](https://docs.adonisjs.com/guides/security/cors#allowed-origin)\n\n### Sending e-mail\n\nYou should send a `POST` request to `/emails/send`\n\nIn development mode: `http://localhost:3333/emails/send`\n\nRequest body:\n\n```json\n{\n  // required if SENDER_MAIL environment variable is not set\n  \"fromEmail\": \"me@example.com\",\n  // optional or equal to SENDER_NAME\n  \"fromName\": \"Team Example\",\n  // required\n  \"toEmail\": \"user@example.com\",\n  // optional\n  \"toName\": \"User Name\",\n  // optional or equal to REPLY_TO_MAIL\n  \"replyToEmail\": \"reply@example.com\",\n  // optional or equal to REPLY_TO_NAME\n  \"replyToName\": \"Team Example\",\n  // required\n  \"subject\": \"Subject of the e-mail\",\n  // default true - if false you should provide a template written in HTML in edge file\n  \"mjml\": true,\n  // file name of your e-mail template - required if you use custom template\n  \"template\": \"example\"\n}\n```\n\n### Use the default template\n\nTo use it, you must not have volume in `docker-compose.yml` and not provide `template` in request body\n\nThe default template:\n\n```html\n\u003cmjml\u003e\n  \u003cmj-head\u003e\n    \u003cmj-attributes\u003e\n      \u003cmj-all font-family=\"'IBM Plex Sans', 'Georgia', 'Times New Roman', serif\" /\u003e\n      \u003cmj-text font-size=\"18px\" color=\"{{ textColor }}\" line-height=\"2\" padding=\"0\" /\u003e\n    \u003c/mj-attributes\u003e\n    \u003cmj-font\n      href=\"https://fonts.googleapis.com/css?family=DM+Serif+Display:normal,italic,bold\u0026display=swap\"\n      name=\"DM Serif Display\"\n    /\u003e\n    \u003cmj-font\n      href=\"https://fonts.googleapis.com/css?family=IBM+Plex+Sans:normal,italic,bold\u0026display=swap\"\n      name=\"IBM Plex Sans\"\n    /\u003e\n  \u003c/mj-head\u003e\n  \u003cmj-body background-color=\"#F2F2F2\"\u003e\n    \u003cmj-section padding=\"32px\"\u003e\n      \u003cmj-column\u003e\n        \u003cmj-image\n          padding=\"0px\"\n          href=\"{{ logoLink }}\"\n          src=\"{{ logoSrc }}\"\n          alt=\"logo\"\n          width=\"150px\"\n        /\u003e\n      \u003c/mj-column\u003e\n    \u003c/mj-section\u003e\n\n    \u003cmj-section background-color=\"#FFFFFF\" border-radius=\"24px\" padding=\"48px\"\u003e\n      \u003cmj-column\u003e\n        @if(title)\n        \u003cmj-text\n          color=\"{{ titleColor }}\"\n          font-size=\"32px\"\n          line-height=\"1.25\"\n          padding-bottom=\"20px\"\n          font-family=\"'DM Serif Display', 'Georgia', 'Times New Roman', serif\"\n        \u003e\n          \u003cstrong\u003e {{ title }}, \u003c/strong\u003e\n        \u003c/mj-text\u003e\n        @endif @if(content)\n        \u003cmj-text\u003e {{{ content }}} \u003c/mj-text\u003e\n        @endif\n      \u003c/mj-column\u003e\n    \u003c/mj-section\u003e\n\n    \u003cmj-section padding=\"48px\"\u003e\n      \u003cmj-column\u003e\n        \u003cmj-image\n          align=\"left\"\n          padding=\"0px\"\n          href=\"{{ logoLink }}\"\n          src=\"{{ logoSrc }}\"\n          width=\"134px\"\n        \u003e\u003c/mj-image\u003e\n      \u003c/mj-column\u003e\n    \u003c/mj-section\u003e\n  \u003c/mj-body\u003e\n\u003c/mjml\u003e\n```\n\n1. Send request with a body like this\n\n```json\n{\n  // Title in the e-mail\n  \"title\": \"Hello World,\",\n  // link open on logo click\n  \"logoLink\": \"https://adonisjs.com/\",\n  // URL of the logo\n  \"logoSrc\":\n    \"https://camo.githubusercontent.com/076aacc894daf3d9065f7d5bd1d7e8a3d0511668576cd66afddd0ce4af524eaa/68747470733a2f2f692e696d6775722e636f6d2f32774764454a4e2e706e67\",\n  // text color of e-mail\n  \"textColor\": \"#1a1a19\",\n  // title text color\n  \"titleColor\": \"#5a45ff\",\n  // content of e-mail, can be written in HTML\n  \"content\": \"\u003cp style=\"margin: 0\"\u003eE-mail content\u003c/p\u003e\",\n  // content of e-mail, can be written in HTML\n  \"subject\": \"Welcome\",\n  // content of e-mail, can be written in HTML\n  \"toEmail\": \"example@site.com\",\n}\n```\n\n2. Result\n\n![Default Template Example](./assets/img/default-template-example.png)\n\n### Custom templates\n\nTemplates should be edge files and use the templating syntax of Adonis ([see default template example](./resources/views/emails/transactional.edge))\n\n[Adonis templating syntax documentation](https://docs.adonisjs.com/guides/views/templating-syntax)\n\n3. Provide your templates\n\nProvide your templates in `docker-compose.yml` volume configuration\n\n```yml\nversion: '3.8'\n\nservices:\n  mailer:\n    ...\n    volumes:\n      - ./path/to/local/emails/directory:/app/resources/views/templates\n```\n\n4. Provide the template to use in body request\n\n```json\n{\n  ...\n  // is the file name - Ex: example.edge\n  \"template\": \"example\"\n  ...\n}\n```\n\n---\n\n## Contributing\n\n### Run server in development mode\n\n```bash\nmake dev\n```\n\n### Build application for production\n\n```bash\nmake build\n```\n\n### Lint and format application\n\n#### Lint with Eslint\n\n```bash\nmake lint\n```\n\n#### Format files with Prettier\n\n```bash\nmake format\n```\n\n### Check dependencies updates\n\n```bash\nmake check-update\n```\n\n### Adonis commands\n\n#### To see all adonis commands, run\n\n```bash\nnode ace -h\n```\n\n#### Create a new controller\n\n```bash\nnode ace make:controller \u003c% ControllerName %\u003e\n```\n\n### Docker\n\n#### Build and start dev server\n\nYou should use this command when the container isn't already initialized\n\n```bash\nmake docker-up-build\n```\n\n#### Start dev server in container\n\n```bash\nmake docker-up\n```\n\n#### Show server logs\n\n```bash\nmake docker-logs\n```\n\n#### Stop server\n\n```bash\nmake docker-stop\n```\n\n#### Stops containers and removes containers, networks, volumes, and images created by up\n\n```bash\nmake docker-down\n```\n\n#### Build docker image\n\n```bash\nmake docker-build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouismazel%2Fdocker-adonis-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouismazel%2Fdocker-adonis-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouismazel%2Fdocker-adonis-mailer/lists"}