{"id":21534762,"url":"https://github.com/zbitname/node-templated-mail","last_synced_at":"2025-03-17T20:15:25.117Z","repository":{"id":65374675,"uuid":"68368289","full_name":"zbitname/node-templated-mail","owner":"zbitname","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-04T05:40:13.000Z","size":7,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-26T21:43:46.109Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zbitname.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-16T09:37:08.000Z","updated_at":"2016-09-16T09:44:37.000Z","dependencies_parsed_at":"2023-01-20T01:25:23.734Z","dependency_job_id":null,"html_url":"https://github.com/zbitname/node-templated-mail","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/zbitname%2Fnode-templated-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbitname%2Fnode-templated-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbitname%2Fnode-templated-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbitname%2Fnode-templated-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zbitname","download_url":"https://codeload.github.com/zbitname/node-templated-mail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102855,"owners_count":20398386,"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-24T03:12:38.084Z","updated_at":"2025-03-17T20:15:25.095Z","avatar_url":"https://github.com/zbitname.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"##Templated email\nEasy development/support and using email templates.\n\n##Supports for other template engines\n###Base usage\n```javascript\nvar Mailer = require('templated-mail');\nvar TemplateProvider = require('templated-mail/providers/template/handlebars');\n\nvar mailer = new Mailer(new TemplateProvider(), {\n  host: 'smtp.example.com',\n  secure: true,\n  port: 465,\n  auth: {\n    user: 'login',\n    pass: 'AwesomePassword'\n  }\n});\n\nmailer\n  .send({\n    from: 'sender@example.com',\n    to: 'receiver@example.com',\n    subject: 'Very important'\n  }, 'template_name', {foo: 'bar'})\n  .then(function(out) {\n    // action on success\n    // `out` = response of server on your request\n    // maybe `out` contains info by error or description some troubles which block sending or receiving message for receiver\n  })\n  .catch(function(err) {\n    // ...\n  });\n```\n\n###Setting helpers\n```javascript\nvar options = {\n  helpers: [Math.round] // helper with name `round`\n};\n\nvar mailer = new Mailer(new TemplateProvider(options), {\n  host: 'smtp.example.com',\n  secure: true,\n  port: 465,\n  auth: {\n    user: 'login',\n    pass: 'AwesomePassword'\n  }\n});\n```\nFunction name is name of helper. You can define by named function. If you use ECMAScript 5 or older version you can use some polyfill (or hook) for `Function.name` property or upgrade nodejs version :)\n\n###Setting templates\nYou can redefine function (`setHTMLTemplateGetter` and `setTextTemplateGetter`) for determine location requested template. If function for `text template` is not defined it will be taken stringified `html template` (without tags).\n\nBy default template path is relative by project \"template\".\n\nUsage example:\n```javascript\n/*\nStructure of your paths for templates:\n /\n └─ home\n  └─ user\n   └─ templates\n    └─ ${name}\n     └─ ${lang}.html.hbs\n */\n\nvar templatePath = '/home/user/templates';\nvar options = {\n  getHTMLtemplate(template) {\n    return `${templatePath}/${template.name}/${template.lang}.html.hbs`;\n  }\n};\n\nvar mailer = new Mailer(new TemplateProvider(options), {\n  host: 'smtp.example.com',\n  secure: true,\n  port: 465,\n  auth: {\n    user: 'login',\n    pass: 'AwesomePassword'\n  }\n});\n```\n\n##Command for test\n```bash\nnode index.test.js --host=smtp.example.com --login=me@example.com --password=AwesomePassword --to=test@example.com --from=me@example.com\n# or short version\nnode index.test.js -H smtp.example.com -L me@example.com -P AwesomePassword -T test@example.com -F me@example.com\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbitname%2Fnode-templated-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzbitname%2Fnode-templated-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbitname%2Fnode-templated-mail/lists"}