{"id":19142422,"url":"https://github.com/eldoy/wmail","last_synced_at":"2026-06-24T07:31:11.948Z","repository":{"id":56323148,"uuid":"201463730","full_name":"eldoy/wmail","owner":"eldoy","description":"Mailgun email client","archived":false,"fork":false,"pushed_at":"2021-10-21T20:39:48.000Z","size":739,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-13T07:06:39.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/eldoy.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}},"created_at":"2019-08-09T12:31:28.000Z","updated_at":"2022-06-04T21:51:51.000Z","dependencies_parsed_at":"2022-08-15T16:40:28.480Z","dependency_job_id":null,"html_url":"https://github.com/eldoy/wmail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eldoy/wmail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/wmail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwmail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34722613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"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-11-09T07:27:11.053Z","updated_at":"2026-06-24T07:31:11.929Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wmail\nSend emails with [Mailgun.](https://mailgun.com) Boasts the following features:\n\n* Send email with Mailgun\n* Layout support\n* Supports HTML, Markdown and Mustache templates\n* Automatically converts HTML to use as text version\n\nMade for the [Waveorb web app development platform.](https://waveorb.com)\n\n### Installation\n```\nnpm i wmail\n```\n\n### Templates\nIn `app/layouts` add a file called `mail.js`:\n```js\nmodule.exports = async function(mail, $, data) {\n  return /* html */`\n    \u003c!doctype html\u003e\n    \u003chtml lang=\"en\"\u003e\n      \u003chead\u003e\n        \u003cmeta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"\u003e\n        \u003ctitle\u003e${mail.subject || 'Wmail'}\u003c/title\u003e\n        \u003cstyle\u003e\n          body { background-color: gold; }\n        \u003c/style\u003e\n      \u003c/head\u003e\n      \u003cbody\u003e\n        \u003cdiv class=\"content\"\u003e${mail.content}\u003c/div\u003e\n        \u003cdiv\u003eBest regards\u003c/div\u003e\n      \u003c/body\u003e\n    \u003c/html\u003e\n  `\n}\n```\n\nThen in your `app/mail` directory add a file called `mail1.js` (or whatever):\n```js\nmodule.exports = async function($, data) {\n  return {\n    layout: 'mail',\n    subject: 'mail1',\n    content: `mail1 html content link ${data.key}`\n  }\n}\n```\n\nThe email content can be written in Markdown:\n```js\n// ...\nformat: 'markdown',\ncontent: `# Hello`\n// ...\n```\nThe layout can't do Markdown, it has to be HTML.\n\nYou can use the file option to set the content from a file:\n```js\nmodule.exports = async function($, data) {\n  return {\n    layout: 'mail',\n    subject: 'mail1',\n    file: 'data/markdown/mail.md'\n  }\n}\n```\nThe markdown will be automatically transformed to HTML if it's a markdown file.\n\n### Variables\nYou can pass variables through the `data` parameter:\n```js\nawait mailer.send('mail1', $, options, data)\n// ...\ncontent: `mail1 html content link ${data.key}`\n// ...\n```\n\nYou can also use [Mustache](https://github.com/janl/mustache.js):\n```js\n// ...\ncontent: `mail1 html content link {{data.key}}`\n// ...\n```\nBoth of these techniques work in the layout as well.\n\n### Configuration\nIn `app/config` add a file called `mail.yml`:\n```yaml\ndomain: example.com\nkey: mailgun-api-key\noptions:\n  reply: mail@example.com\n  from: mail@example.com\n  to: mail@example.com\n```\n\nCreate a plugin in `app/plugins` called `mailer.js`:\n```js\nconst mailer = require('wmail')\n\nmodule.exports = async function(app) {\n  app.mailer = mailer(app.config.mail)\n}\n```\n\n### Send email\nEmails will automatically include the text version which is converted from the HTML in your templates.\n\n```js\n// Use mailer from plugin\nconst mailer = $.app.mailer\n\n// Send email\nconst options = {\n  to: 'Vidar Eldøy \u003cvidar@eldoy.com\u003e',\n  attachment: [file]\n}\n\n// All possible options:\n{\n  to: 'vidar@eldoy.com',\n  from: 'vidar@eldoy.com',\n  cc: 'cc@eldoy.com',\n  bcc: 'bcc@eldoy.com',\n  subject: 'hello',\n  html: '\u003ch1\u003eHello\u003c/h1\u003e',\n  text: 'Hello',\n  reply: 'vidar@eldoy.com',\n  attachment: [readStream],\n  inline: [readStream]\n}\n\n// Parameters: name, $, options, data\nconst data = { key: 'hello' }\nconst result = await mailer.send('mail1', $, options, data)\n\n// On success\n{\n  id: '\u003c20190910043104.1.043A7DC389CBE263@eldoy.com\u003e',\n  message: 'Queued. Thank you.'\n}\n\n// On error\n{\n  \"id\": undefined,\n  \"message\": \"'from' parameter is missing\",\n  \"status\": 400\n}\n```\n\nMIT licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fwmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fwmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fwmail/lists"}