{"id":19142407,"url":"https://github.com/eldoy/waveorb-mailer","last_synced_at":"2026-06-10T19:30:19.125Z","repository":{"id":139869139,"uuid":"376639297","full_name":"eldoy/waveorb-mailer","owner":"eldoy","description":"Send emails made for Waveorb","archived":false,"fork":false,"pushed_at":"2023-03-07T12:18:57.000Z","size":652,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-03T15:27:17.291Z","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-13T20:59:53.000Z","updated_at":"2022-06-04T21:51:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a98e3d0-2ca1-4d02-97cb-03b736966a8c","html_url":"https://github.com/eldoy/waveorb-mailer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwaveorb-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwaveorb-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwaveorb-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fwaveorb-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/waveorb-mailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240223387,"owners_count":19767615,"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":[],"created_at":"2024-11-09T07:27:08.692Z","updated_at":"2026-06-10T19:30:19.055Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Waveorb Mailer\nSend emails with [Waveorb.](https://waveorb.com) Boasts the following features:\n\n* Send email with [mxmail](https://github.com/eldoy/mxmail)\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 waveorb-mailer\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 || 'Waveorb Mailer'}\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\n\nIf you don't provide a config file emails will be sent through mx record lookup.\n\nTo use your own email server to send mail, create a file called `mail.yml` in `app/config`:\n```yaml\nhost: smtp.ethereal.email\nport: 587\nauth:\n  user: virginia.cassin10@ethereal.email\n  pass: 1md9Xes49Nbfka6aFw\n```\n\nCreate a plugin in `app/plugins` called `mailer.js`:\n```js\nconst mailer = require('waveorb-mailer')\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  replyTo: 'vidar@eldoy.com',\n  attachment: [readStream]\n}\n\n// Parameters: name, $, options, data\nconst data = { key: 'hello' }\nconst result = await mailer.send('mail1', $, options, data)\n\n// Returns delivered and failed emails\n{\n  delivered: [{ result, mail }],\n  failed: [{ result, mail }]\n}\n```\n\nMIT licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fwaveorb-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fwaveorb-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fwaveorb-mailer/lists"}