{"_id":"@bouncingpixel/mailgun-emails","_rev":"6-6eb99fb4761268eb620456bf68f02d63","name":"@bouncingpixel/mailgun-emails","description":"Emailer capability using mailgun to send and DustJS for rendering","dist-tags":{"latest":"0.3.0-beta"},"versions":{"0.2.0":{"name":"@bouncingpixel/mailgun-emails","version":"0.2.0","description":"Emailer capability using mailgun to send and DustJS for rendering","main":"index.js","scripts":{},"repository":{"type":"git","url":"https://github.com/BouncingPixel/node-packages/tree/master/mailgun-emails"},"author":{"name":"Matt Hall","email":"mhall@bouncingpixel.com"},"license":"MIT","bugs":{"url":"https://github.com/BouncingPixel/node-packages/issues"},"homepage":"https://github.com/BouncingPixel/node-packages","engines":{"node":"6.x"},"dependencies":{"dustjs-linkedin":"2.7.5","mailgun-js":"^0.8.0","nconf":"^0.8.4","winston":"^2.3.0"},"_id":"@bouncingpixel/mailgun-emails@0.2.0","_shasum":"71323e5b8560f8913b3ea63e477f231d4472401e","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"bouncingpixel","email":"mhall@bouncingpixel.com"},"dist":{"shasum":"71323e5b8560f8913b3ea63e477f231d4472401e","tarball":"https://registry.npmjs.org/@bouncingpixel/mailgun-emails/-/mailgun-emails-0.2.0.tgz","integrity":"sha512-hR1ivZVAB0ThhgQZBwKHk/GbUqu+rK5SdfhP1emJbrTC52G2YyzAgko08QGYI8ARTfFNOZBcGi0ujLUvxUDoKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5YCv+Pr4qkpqe9CFavj9vNJslJEvCent4VbHqCM5QFgIhAOwI+3Ot9IH0HKjjeJVh6mpBGpMsERwdZjbvv69klO2r"}]},"maintainers":[{"name":"bouncingpixel","email":"mhall@bouncingpixel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mailgun-emails-0.2.0.tgz_1495492186334_0.2899924817029387"},"directories":{}},"0.2.1":{"name":"@bouncingpixel/mailgun-emails","version":"0.2.1","description":"Emailer capability using mailgun to send and DustJS for rendering","main":"index.js","scripts":{"lint":"eslint index.js src"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/BouncingPixel/node-packages/tree/master/mailgun-emails"},"author":{"name":"Matt Hall","email":"mhall@bouncingpixel.com"},"license":"MIT","bugs":{"url":"https://github.com/BouncingPixel/node-packages/issues"},"homepage":"https://github.com/BouncingPixel/node-packages","engines":{"node":">=6.9.0"},"dependencies":{"dustjs-linkedin":"2.7.5","mailgun-js":"^0.8.0","nconf":"^0.8.4","winston":"^2.3.0"},"_id":"@bouncingpixel/mailgun-emails@0.2.1","_shasum":"7029867b1700a219f8d25bb85307a36e9ad6f819","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"bouncingpixel","email":"mhall@bouncingpixel.com"},"dist":{"shasum":"7029867b1700a219f8d25bb85307a36e9ad6f819","tarball":"https://registry.npmjs.org/@bouncingpixel/mailgun-emails/-/mailgun-emails-0.2.1.tgz","integrity":"sha512-zBkPZU/2GiSxe2yO5UmcfxRAjdTmzA7Su7QAk0NoF4R8UEq/WfC/8A7PRfDQZoDv32ur0Bg69hHUqiRLvZbC9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHUtU3A8ZISCIUqUH914jaqXiBcpO0W1tSdyWzHVNpuAIgNnjGS5f5QE2K/4JNSCKiyh5TDjveOJWplyxgVgN6P6c="}]},"maintainers":[{"name":"bouncingpixel","email":"mhall@bouncingpixel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mailgun-emails-0.2.1.tgz_1503085177672_0.8491757698357105"},"directories":{}},"0.3.0-beta":{"name":"@bouncingpixel/mailgun-emails","version":"0.3.0-beta","description":"Emailer capability using mailgun to send and DustJS for rendering","main":"index.js","scripts":{"lint":"eslint index.js src"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/BouncingPixel/node-packages/tree/master/mailgun-emails"},"author":{"name":"Matt Hall","email":"mhall@bouncingpixel.com"},"license":"MIT","bugs":{"url":"https://github.com/BouncingPixel/node-packages/issues"},"homepage":"https://github.com/BouncingPixel/node-packages","engines":{"node":"^14.x"},"dependencies":{"dustjs-linkedin":"2.7.5","mailgun-js":"^0.22.0","nconf":"^0.11.1","winston":"^3.3.0"},"_id":"@bouncingpixel/mailgun-emails@0.3.0-beta","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-WVAtk4GYQnNc57643yqjQXJAyropSD7QFDrTo0nCT/4NXoDTWb9QPO8TY2QRxhJXdSX/UW1Zv8fzmgAd+bMk5A==","shasum":"6166de6426c1d5bf1d45748cb7bf9bebc1707148","tarball":"https://registry.npmjs.org/@bouncingpixel/mailgun-emails/-/mailgun-emails-0.3.0-beta.tgz","fileCount":4,"unpackedSize":10355,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgByKdCRA9TVsSAnZWagAA9/4P/A5apm8NonqSO6D3GKxB\npvngUZuak3EpBYNfAYWqyFmV6tWx+WQMq0j0F85rTGUFqJcnk3q7wxosGRH3\niK3dmCHy+zB46Ei91GvBm3TRLEeuBcSwg4TPJI7unIderWtV/5P1p/QD7AVf\nzKTKkXjERwn2S+odtRcUAFm6ydr4dz8S75McQKdPNC00R9tMCS/+QtBIrXNi\nw8Z4LresXEgkWGyB98hKP+DSKX8aQ4kQOsDsFkcDcWMtG6P5bOqu2qeRAp6s\nbPEJR7xggLielstaP3nQwTpt+ungKDLf/A9CP3EVcBvbJBYvMR2LAlqSVB1d\n8o4Wz7RQJdJRIe7kTCPcJ+2+TzX5MCPPJfHoz0AbK0H7zdYD/icbWlHXoG/R\n0/mAwOaUWVRrmeQ5YLBgBdkVpCdgsf/c8paDLiW49Di5oNkd3PhdFZAVFNGQ\nzktV4eVZbPg7JosC6kUhcRdvgy6w0vF5fBioH1215mkd2s1VJy3ZYJbqcigx\n8nDiM9TUDR6tB4g9YEKL66IVTj5BT0iLLnwiIJ4L37Mxzr9uXKWBcXNkdeMR\nkfd2IrvNDTYVQhuHGuhY7Iq88/xCU5+OM2eW5hPFvQ8kdYbfo2zJyU/23bRA\nEsEsS0Gf+igjKPf4X3HycqgMYEpaS+/9FVptp09eeM19sXhleKa6iDsfPGRb\nxmWX\r\n=HJoz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCWb2UM6tFHvZ5H6QlWJ/syUB9EvLkDtbnucRdOHzXsjQIgEcG+0A/OdFD5mda8bg++g55T8CRTURDvO1xjRuAhVFA="}]},"_npmUser":{"name":"hallmatt","email":"mhall@bouncingpixel.com"},"directories":{},"maintainers":[{"name":"hallmatt","email":"mhall@bouncingpixel.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mailgun-emails_0.3.0-beta_1611080348852_0.035823583178680396"},"_hasShrinkwrap":false}},"readme":"# mailgun-emails\n\nA utility for sending emails using Mailgun.\nEmails are defined in a directory with a `.dust` template file and a `.js` settings file.\n\n## Working With the Template\n\n### Requirements\n\n- NodeJS 6 LTS\n- dustjs-linkedin pre-initialized\n- A Mailgun account\n\n### Configuration\n\nThis module, like many other `@bouncingpixel` modules, relies on nconf.\nThe following configuration keys should be defined to use this module:\n\n#### Required\n- `mailgunTemplatePath`\n  The path to the directory containing the template dust and JS settings files.\n- `mailgunDomain`\n  The domain used in the mailgun configuration. If left unset, sending emails will simply return without sending and without errors.\n- `mailgunApiKey`\n  The API key for accessing mailgun. If left unset, sending emails will simply return without sending and without errors.\n\n#### Optional\n- `mailgunDefaultFrom`\n  The default address to use in the From field when an email does not have a specific one defined.\n- `siterootHost`\n  The site's root host such as `mydomain.com` for URLs rendered by Dust. The resulting URL is defined as `siterootUrl`\n- `requireHTTPS`\n  If `siterootUrl` is defined, this defines if any URLs sent to the user should be HTTP or HTTPS\n\n### Using mailgun-emails\n\nThe email folder is used to store the configuration and dust template files for each email that could be sent.\nAn email type must contain both files: a JS file which exports an object containing the configuration for that email,\nand a dust file defining the template to be displayed to the end user. For mass-sent emails that need individual variables,\nMailgun supports per-recipient variables. Expose the variable in the configuration using `individualVars`, and then\nuse the format `%recipient.VARIABLE%` where `VARIABLE` is the name of the variable exposed. All variables shared between\nall recipients can skip the Mailgun template variables and use Dust directly. These variables are exposed with `dustVars`.\n\nEach email can define who the from address is. This can either be a function which returns the from address or a string.\nEach email can define who the to addresses are. This field is an array and can either contain a string of each email or\nan object such as `{name: \"Person's name\", email: \"email@address.domain\"}`.\nFinally, the email configuration must define a subject, which may be a function or a string.\n\nEach of the functions defined for `to`, `from`, `subject`, `individualVars`, and `dustVars` take only one parameter\nwhich contains all options passed into the call to `sendTemplateEmail`.\n\nSending an email uses the function `sendTemplateEmail`. This function returns a promise.\n\n```ts\n// Sends an email\nsendTemplateEmail(options: {\n  // template, required\n  // the name of the template to load. This is the filename of the .dust/.js file.\n  template: string,\n\n  // recipients, required unless template settings defines `to`\n  recipients: string[] | {name: string, email: string}[],\n\n  // any additional parameters needed for processing may be passed\n}): Promise\n```\n\n### Creating a template\n\nA template consists of two parts: a dust template and a JS settings file.\nThe dust file is just normal dust and any helpers that are attached to the dust JS.\n\nThe settings file is a single exported object.\nThe settings file is as follows:\n```js\nmodule.exports = {\n  // from is optional if mailgunDefaultFrom is defined. will always use this as from if available.\n  // this can optionally be a function that takes a single parameter: the options passed to sendTemplateEmail\n  from: 'Our Site <noreply@oursite.com>',\n\n  // to is optional if the recipients is defined in the sendTemplateEmail options parameter\n  // this can optionally be a function that takes a single parameter: the options passed to sendTemplateEmail\n  to: ['whogetsit@oursite.com'],\n\n  // the subject of the email to send, this is required\n  // this can optionally be a function that takes a single parameter: the options passed to sendTemplateEmail\n  subject: 'My email subject',\n\n  // dustVars is an optional function to filter or manipulate the options to generate variables exposed to dust\n  // by default, all options passed to sendTemplateEmail if this is not defined\n  dustVars: function(options) {\n    return options;\n  },\n\n  // individualVars is an optional function to determine which values each recipient recieves\n  // this uses Mailgun's templates, not the dustjs!\n  individualVars: function(recipient, opts) {\n    return null;\n  }\n};\n```\n","maintainers":[{"name":"hallmatt","email":"mhall@bouncingpixel.com"}],"time":{"modified":"2022-06-12T15:26:48.693Z","created":"2017-05-22T22:29:47.277Z","0.2.0":"2017-05-22T22:29:47.277Z","0.2.1":"2017-08-18T19:39:38.523Z","0.3.0-beta":"2021-01-19T18:19:09.023Z"},"homepage":"https://github.com/BouncingPixel/node-packages","repository":{"type":"git","url":"https://github.com/BouncingPixel/node-packages/tree/master/mailgun-emails"},"author":{"name":"Matt Hall","email":"mhall@bouncingpixel.com"},"bugs":{"url":"https://github.com/BouncingPixel/node-packages/issues"},"license":"MIT","readmeFilename":"README.md"}