{"_id":"@djez/smtp-mailer","_rev":"4-154b8bdf4a0b2d3201e90e070bdd4a8c","name":"@djez/smtp-mailer","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@djez/smtp-mailer","version":"1.0.0","keywords":["nodemailer","smtp","tls","dkim","email","mailer","templates"],"author":{"name":"Djezou Eric Martial","email":"martialdjezou@gmail.com"},"license":"MIT","_id":"@djez/smtp-mailer@1.0.0","maintainers":[{"name":"djezou","email":"martialdjezou@gmail.com"}],"homepage":"https://github.com/djezou/smtp-mailer#readme","bugs":{"url":"https://github.com/djezou/smtp-mailer/issues"},"dist":{"shasum":"deac595ffe539359caf7e256ee32e237705c1dd9","tarball":"https://registry.npmjs.org/@djez/smtp-mailer/-/smtp-mailer-1.0.0.tgz","fileCount":8,"integrity":"sha512-GHw2Uay2EdH4e5i2C2g5pDDddbQSu8PvFswXIB2lmfF8+k2Mpn0c05HNhWSOuLAori93bef9wS1TgGAL3upB5w==","signatures":[{"sig":"MEQCIBemhjs0X0WeqDfc2rrQ00U+AU8R/XM3vSuf2H60sxScAiBgk/F2KLuESKrp3+UjIYlNQ2VHWTnRTTZvLoSNsc0XsA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7993},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"echo \"(tests à ajouter)\"","build":"tsc -p tsconfig.json","clean":"powershell -NoProfile -Command \"if (Test-Path dist) { Remove-Item -Recurse -Force dist }\"","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"djezou","email":"martialdjezou@gmail.com"},"repository":{"url":"git+https://github.com/djezou/smtp-mailer.git","type":"git"},"_npmVersion":"10.8.2","description":"Mailer SMTP personnalisé basé sur Nodemailer (TLS, DKIM, pool, retry, templates Handlebars).","directories":{},"sideEffects":false,"_nodeVersion":"20.19.2","dependencies":{"handlebars":"^4.7.8","nodemailer":"^7.0.10"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^22.13.10","@types/nodemailer":"^7.0.3"},"_npmOperationalInternal":{"tmp":"tmp/smtp-mailer_1.0.0_1761918832680_0.39659691262650454","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@djez/smtp-mailer","version":"1.0.1","keywords":["nodemailer","smtp","tls","dkim","email","mailer","templates"],"author":{"name":"Djezou Eric Martial","email":"martialdjezou@gmail.com"},"license":"MIT","_id":"@djez/smtp-mailer@1.0.1","maintainers":[{"name":"djezou","email":"martialdjezou@gmail.com"}],"homepage":"https://github.com/djezou/smtp-mailer#readme","bugs":{"url":"https://github.com/djezou/smtp-mailer/issues"},"dist":{"shasum":"aed2d468534c0047e2ccdb6c8515d999492a64b1","tarball":"https://registry.npmjs.org/@djez/smtp-mailer/-/smtp-mailer-1.0.1.tgz","fileCount":8,"integrity":"sha512-0/owCWnRzEFwyXK65ENAPR90Vq2RdH5X/ZLG+fxZ3hPFqCitOt7ROnX8zW7Jo4a+IrI+oYELdeIMKrlks4GJvA==","signatures":[{"sig":"MEYCIQCH8ZHzAifDJ3DFFgJWFX7VEu2f4ETDFB3fQ1MoR3GknAIhALjDicURs9DObBosLDtk6Rr9H2uF7HxAl9w+V2cPfVXm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14823},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"echo \"(tests à ajouter)\"","build":"tsc -p tsconfig.json","clean":"powershell -NoProfile -Command \"if (Test-Path dist) { Remove-Item -Recurse -Force dist }\"","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"djezou","email":"martialdjezou@gmail.com"},"repository":{"url":"git+https://github.com/djezou/smtp-mailer.git","type":"git"},"_npmVersion":"10.8.2","description":"Mailer SMTP personnalisé basé sur Nodemailer (TLS, DKIM, pool, retry, templates Handlebars).","directories":{},"sideEffects":false,"_nodeVersion":"20.19.2","dependencies":{"handlebars":"^4.7.8","nodemailer":"^7.0.10"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^22.13.10","@types/nodemailer":"^7.0.3"},"_npmOperationalInternal":{"tmp":"tmp/smtp-mailer_1.0.1_1761919471619_0.2433888533975237","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@djez/smtp-mailer","version":"1.1.0","keywords":["nodemailer","smtp","tls","dkim","email","mailer","templates"],"author":{"name":"Djezou Eric Martial","email":"martialdjezou@gmail.com"},"license":"MIT","_id":"@djez/smtp-mailer@1.1.0","maintainers":[{"name":"djezou","email":"martialdjezou@gmail.com"}],"homepage":"https://github.com/djezou/smtp-mailer#readme","bugs":{"url":"https://github.com/djezou/smtp-mailer/issues"},"dist":{"shasum":"d09fc4fee275caf895825012f28fbafff3414620","tarball":"https://registry.npmjs.org/@djez/smtp-mailer/-/smtp-mailer-1.1.0.tgz","fileCount":14,"integrity":"sha512-PJYKQM/pGjVeAiiyI+KadLOcZn3sO3/CQrbVl37HAU4dl5WH8vvSUiFKU6Z3W3MLG5faudS9Ck+Z9MiR4HjmGQ==","signatures":[{"sig":"MEUCIFdCMnlw6iEbDLxcbwJZmHUlqeTJWUQMXS7erpCf3DHxAiEAoolRxeD2/Gv5daFzis9S6BegB1qkHoH9O60pMpp4HNo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23079},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist-cjs/index.js"}},"scripts":{"test":"echo \"(tests à ajouter)\"","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"powershell -NoProfile -Command \"if (Test-Path dist) { Remove-Item -Recurse -Force dist }; if (Test-Path dist-cjs) { Remove-Item -Recurse -Force dist-cjs }\"","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"djezou","email":"martialdjezou@gmail.com"},"repository":{"url":"git+https://github.com/djezou/smtp-mailer.git","type":"git"},"_npmVersion":"10.8.2","description":"Mailer SMTP personnalisé basé sur Nodemailer (TLS, DKIM, pool, retry, templates Handlebars).","directories":{},"sideEffects":false,"_nodeVersion":"20.19.2","dependencies":{"handlebars":"^4.7.8","nodemailer":"^7.0.10"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^22.13.10","@types/nodemailer":"^7.0.3"},"_npmOperationalInternal":{"tmp":"tmp/smtp-mailer_1.1.0_1761925551309_0.069335179030513","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@djez/smtp-mailer","version":"1.1.1","description":"Mailer SMTP personnalisé basé sur Nodemailer (TLS, DKIM, pool, retry, templates Handlebars).","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist-cjs/index.cjs","default":"./dist/index.js"}},"sideEffects":false,"scripts":{"clean":"powershell -NoProfile -Command \"if (Test-Path dist) { Remove-Item -Recurse -Force dist }; if (Test-Path dist-cjs) { Remove-Item -Recurse -Force dist-cjs }\"","build:esm":"tsc -p tsconfig.json","build:cjs":"tsc -p tsconfig.cjs.json","rename:cjs":"powershell -NoProfile -Command \"Get-ChildItem -Path dist-cjs -Filter *.js | ForEach-Object { Rename-Item -Path $_.FullName -NewName ($_.Name -replace '\\.js$', '.cjs') }; Get-ChildItem -Path dist-cjs -Filter *.cjs | ForEach-Object { (Get-Content $_.FullName -Raw) -replace '\\.js\"', '.cjs\"' | Set-Content $_.FullName -NoNewline }\"","build":"npm run clean && npm run build:esm && npm run build:cjs && npm run rename:cjs","prepublishOnly":"npm run build","test":"echo \"(tests à ajouter)\""},"keywords":["nodemailer","smtp","tls","dkim","email","mailer","templates"],"author":{"name":"Djezou Eric Martial","email":"martialdjezou@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/djezou/smtp-mailer.git"},"bugs":{"url":"https://github.com/djezou/smtp-mailer/issues"},"homepage":"https://github.com/djezou/smtp-mailer#readme","engines":{"node":">=18.0.0"},"dependencies":{"handlebars":"^4.7.8","nodemailer":"^7.0.10"},"devDependencies":{"@types/node":"^22.13.10","@types/nodemailer":"^7.0.3","typescript":"^5.8.2"},"_id":"@djez/smtp-mailer@1.1.1","_nodeVersion":"20.19.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-sNP7P/GTkAHIKDMUXMFKvXc6gcgBXSvxRWhWrKMK+0yD3YITsOo6CB1nwTxL/lvMK5IOlgw4H1wQwkr00p4LyA==","shasum":"1186bb46ad525afe7831f53ca14651e180c2a4d6","tarball":"https://registry.npmjs.org/@djez/smtp-mailer/-/smtp-mailer-1.1.1.tgz","fileCount":14,"unpackedSize":23460,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDyBwsF9XfScMMlALn1NJZJNEDjd40XE01pPwVgXmSN/AIgIyHGDI/hl3brbm/lV746/r4WPCJq8eszQV7qCeqboEI="}]},"_npmUser":{"name":"djezou","email":"martialdjezou@gmail.com"},"directories":{},"maintainers":[{"name":"djezou","email":"martialdjezou@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/smtp-mailer_1.1.1_1761926213597_0.07828929763435344"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-31T13:53:52.544Z","modified":"2025-10-31T15:56:54.123Z","1.0.0":"2025-10-31T13:53:52.884Z","1.0.1":"2025-10-31T14:04:31.807Z","1.1.0":"2025-10-31T15:45:51.508Z","1.1.1":"2025-10-31T15:56:53.800Z"},"bugs":{"url":"https://github.com/djezou/smtp-mailer/issues"},"author":{"name":"Djezou Eric Martial","email":"martialdjezou@gmail.com"},"license":"MIT","homepage":"https://github.com/djezou/smtp-mailer#readme","keywords":["nodemailer","smtp","tls","dkim","email","mailer","templates"],"repository":{"type":"git","url":"git+https://github.com/djezou/smtp-mailer.git"},"description":"Mailer SMTP personnalisé basé sur Nodemailer (TLS, DKIM, pool, retry, templates Handlebars).","maintainers":[{"name":"djezou","email":"martialdjezou@gmail.com"}],"readme":"# @djez/smtp-mailer\r\n\r\nMailer SMTP personnalisé basé sur Nodemailer avec support TLS, DKIM, pool de connexions, retry automatique et templates Handlebars.\r\n\r\n## 📦 Installation\r\n\r\n```bash\r\nnpm install @djez/smtp-mailer\r\n```\r\n\r\n## 🚀 Utilisation\r\n\r\n### Configuration de base\r\n\r\n```typescript\r\nimport { SMTPMailer } from '@djez/smtp-mailer';\r\n\r\nconst mailer = new SMTPMailer({\r\n  host: 'smtp.example.com',\r\n  port: 587,\r\n  secure: false, // true pour le port 465\r\n  auth: {\r\n    user: 'votre@email.com',\r\n    pass: 'votre-mot-de-passe',\r\n  },\r\n  fromDefault: 'Votre Nom <votre@email.com>',\r\n});\r\n```\r\n\r\n### Envoi d'email simple\r\n\r\n```typescript\r\nconst info = await mailer.send({\r\n  to: 'destinataire@example.com',\r\n  subject: 'Test d\\'email',\r\n  html: '<h1>Bonjour</h1><p>Ceci est un test.</p>',\r\n  text: 'Bonjour, ceci est un test.',\r\n});\r\n```\r\n\r\n### Envoi avec pièces jointes\r\n\r\n```typescript\r\nconst info = await mailer.send({\r\n  to: 'destinataire@example.com',\r\n  subject: 'Email avec pièce jointe',\r\n  html: '<p>Veuillez trouver ci-joint le document.</p>',\r\n  attachments: [\r\n    {\r\n      filename: 'document.pdf',\r\n      path: '/chemin/vers/document.pdf',\r\n    },\r\n  ],\r\n});\r\n```\r\n\r\n### Utilisation de templates Handlebars\r\n\r\nCréez un fichier template dans le dossier `templates` :\r\n\r\n#### templates/welcome.hbs\r\n\r\n```handlebars\r\n<!DOCTYPE html>\r\n<html lang=\"fr\">\r\n  <head>\r\n    <meta charset=\"utf-8\">\r\n    <title>{{title}}</title>\r\n  </head>\r\n  <body style=\"font-family:Arial,Helvetica,sans-serif\">\r\n    <h1>{{title}}</h1>\r\n    <p>Bonjour {{name}},</p>\r\n    <p>Bienvenue sur notre plateforme 🎉</p>\r\n    <p>— L'équipe</p>\r\n  </body>\r\n</html>\r\n```\r\n\r\nPuis utilisez-le :\r\n\r\n```typescript\r\nconst mailer = new SMTPMailer({\r\n  // ... configuration\r\n  templateDir: './templates',\r\n});\r\n\r\nconst info = await mailer.sendTemplate({\r\n  template: 'welcome',\r\n  to: 'utilisateur@example.com',\r\n  subject: 'Bienvenue !',\r\n  data: {\r\n    title: 'Bienvenue sur notre site',\r\n    name: 'Jean Dupont',\r\n  },\r\n});\r\n```\r\n\r\n### Configuration avancée avec pool\r\n\r\n```typescript\r\nconst mailer = new SMTPMailer({\r\n  host: 'smtp.example.com',\r\n  port: 587,\r\n  auth: {\r\n    user: 'votre@email.com',\r\n    pass: 'votre-mot-de-passe',\r\n  },\r\n  fromDefault: 'Votre Nom <votre@email.com>',\r\n  \r\n  // Pool de connexions (recommandé en production)\r\n  pool: {\r\n    pool: true,\r\n    maxConnections: 5,\r\n    maxMessages: 100,\r\n    rateLimit: 50,\r\n    rateDelta: 1000,\r\n  },\r\n  \r\n  // Configuration TLS\r\n  tls: {\r\n    minVersion: 'TLSv1.2',\r\n    rejectUnauthorized: true,\r\n  },\r\n  \r\n  // Retry automatique\r\n  retries: 3,\r\n  retryDelayMs: 2000,\r\n  \r\n  // Mode debug\r\n  debug: true,\r\n});\r\n```\r\n\r\n### Health check\r\n\r\n```typescript\r\nconst isHealthy = await mailer.healthCheck();\r\nif (isHealthy) {\r\n  console.log('SMTP server is ready');\r\n}\r\n```\r\n\r\n### Mode dry run (test sans envoi)\r\n\r\n```typescript\r\nconst mailer = new SMTPMailer({\r\n  // ... configuration\r\n  dryRun: true,\r\n  debug: true,\r\n});\r\n\r\n// Les emails seront loggés mais pas envoyés\r\nawait mailer.send({\r\n  to: 'test@example.com',\r\n  subject: 'Test',\r\n  html: '<p>Test</p>',\r\n});\r\n```\r\n\r\n### Fermeture du pool\r\n\r\n```typescript\r\n// Toujours fermer le pool en production\r\nawait mailer.close();\r\n```\r\n\r\n## ⚙️ Configuration\r\n\r\n### SMTPConfig\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `host` | `string` | **Requis.** Serveur SMTP |\r\n| `port` | `number` | **Requis.** Port SMTP (587, 465, etc.) |\r\n| `secure` | `boolean` | `true` pour le port 465 |\r\n| `auth` | `SMTPAuth` | Identifiants d'authentification |\r\n| `fromDefault` | `string \\| Address` | Adresse expéditeur par défaut |\r\n| `tls` | `TLSOptions` | Options TLS |\r\n| `pool` | `PoolOptions` | Configuration du pool |\r\n| `templateDir` | `string` | Dossier contenant les templates `.hbs` |\r\n| `dryRun` | `boolean` | Mode test sans envoi |\r\n| `retries` | `number` | Nombre de tentatives (défaut: 2) |\r\n| `retryDelayMs` | `number` | Délai entre tentatives en ms (défaut: 1000) |\r\n| `debug` | `boolean` | Active les logs de debug |\r\n\r\n### TLSOptions\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `minVersion` | `string` | Version TLS minimale (ex: \"TLSv1.2\") |\r\n| `cert` | `string \\| Buffer` | Certificat client |\r\n| `key` | `string \\| Buffer` | Clé privée client |\r\n| `rejectUnauthorized` | `boolean` | Rejeter certificats non autorisés (défaut: true) |\r\n\r\n### PoolOptions\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `pool` | `boolean` | Active le pooling (recommandé) |\r\n| `maxConnections` | `number` | Nombre max de connexions simultanées (défaut: 5) |\r\n| `maxMessages` | `number` | Max messages par connexion (défaut: 100) |\r\n| `rateDelta` | `number` | Période de rate limiting en ms (défaut: 1000) |\r\n| `rateLimit` | `number` | Limite de messages par période |\r\n\r\n## 📝 Exemples\r\n\r\n### Email transactionnel\r\n\r\n```typescript\r\nawait mailer.send({\r\n  to: 'client@example.com',\r\n  subject: 'Confirmation de commande',\r\n  html: `\r\n    <h2>Merci pour votre commande !</h2>\r\n    <p>Votre commande #${orderId} a été confirmée.</p>\r\n    <p>Montant: ${amount} €</p>\r\n  `,\r\n});\r\n```\r\n\r\n### Email à plusieurs destinataires\r\n\r\n```typescript\r\nawait mailer.send({\r\n  to: ['dest1@example.com', 'dest2@example.com'],\r\n  cc: 'carbon-copy@example.com',\r\n  bcc: 'blind-copy@example.com',\r\n  subject: 'Newsletter',\r\n  html: '<p>Contenu de la newsletter</p>',\r\n});\r\n```\r\n\r\n### Email avec reply-to personnalisé\r\n\r\n```typescript\r\nawait mailer.send({\r\n  to: 'client@example.com',\r\n  subject: 'Support technique',\r\n  html: '<p>Comment pouvons-nous vous aider ?</p>',\r\n  replyTo: 'support@example.com',\r\n});\r\n```\r\n\r\n## 🔧 Développement\r\n\r\n```bash\r\n# Installation des dépendances\r\nnpm install\r\n\r\n# Compilation TypeScript\r\nnpm run build\r\n\r\n# Nettoyage du dossier dist\r\nnpm run clean\r\n```\r\n\r\n## 📚 API\r\n\r\n### Classes\r\n\r\n#### `SMTPMailer`\r\n\r\nClasse principale pour l'envoi d'emails SMTP.\r\n\r\n**Méthodes :**\r\n\r\n- `constructor(config: SMTPConfig)` - Crée une instance de mailer\r\n- `send(opts: SendOptions)` - Envoie un email\r\n- `sendTemplate<T>(opts: TemplateOptions<T>)` - Envoie un email basé sur un template\r\n- `healthCheck()` - Vérifie la connexion SMTP\r\n- `close()` - Ferme le pool de connexions\r\n\r\n## ⚠️ Notes importantes\r\n\r\n- Le pool de connexions est recommandé en production pour de meilleures performances\r\n- Le mode `dryRun` est utile pour les tests en développement\r\n- Le retry automatique est configuré par défaut (2 tentatives, 1 seconde de délai)\r\n- Les templates Handlebars sont compilés à chaque envoi\r\n\r\n## 📄 Licence\r\n\r\nMIT\r\n\r\n## 👤 Auteur\r\n\r\nDjezou Eric Martial <martialdjezou@gmail.com>\r\n\r\n## 🔗 Liens\r\n\r\n- [GitHub](https://github.com/djezou/smtp-mailer)\r\n- [Issues](https://github.com/djezou/smtp-mailer/issues)\r\n","readmeFilename":"README.md"}