{"_id":"mail-bridge","_rev":"27-1954aa77f10627486588d04bbf06d9ba","name":"mail-bridge","dist-tags":{"latest":"1.0.2"},"versions":{"0.1.0":{"name":"mail-bridge","version":"0.1.0","keywords":["email","send-email","email-provider"],"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","_id":"mail-bridge@0.1.0","maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"homepage":"https://github.com/thtauhid/mail-bridge","bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"dist":{"shasum":"975654976b12227d2044a48832534db986394926","tarball":"https://registry.npmjs.org/mail-bridge/-/mail-bridge-0.1.0.tgz","fileCount":6,"integrity":"sha512-h0KNRzwwMHL3B3bbmX7WCoV82gONV4BqWce3dGajftAPFOxpZ/jlACuOWVD3MwUQP8rL37OLPdronTUvlPiqkg==","signatures":[{"sig":"MEUCIQDbiZ6z+5hs3DV59du0C8iNyzTWclHDLjiuMvag9wgg6wIgZ/QunSYNzoZmlPOHjbufiQK1voN7UHEL5kBkwFa4auw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25322},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"97297b9a99a65ac1b4a6ec1240417595278dc7d5","scripts":{"dev":"tsnd --respawn src/index.ts","lint":"tsc","test":"tsnd --respawn test/index.ts","build":"tsup src/index.ts --format esm,cjs --dts","start":"node build/index.js","prepublishOnly":"pnpm build"},"_npmUser":{"name":"thtauhid","email":"thtauhid.71@gmail.com"},"repository":{"url":"git+https://github.com/thtauhid/mail-bridge.git","type":"git"},"_npmVersion":"10.2.4","description":"Send email using any email provider.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"resend":"^3.2.0","form-data":"^4.0.0","mailgun.js":"^10.2.1","nodemailer":"^6.9.12","@aws-sdk/client-ses":"^3.529.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","dotenv":"^16.4.5","typescript":"^5.4.2","@types/node":"^20.11.25","ts-node-dev":"^2.0.0","@types/react":"^18.2.64","@types/nodemailer":"^6.4.14"},"_npmOperationalInternal":{"tmp":"tmp/mail-bridge_0.1.0_1710092843146_0.37966842938775436","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"mail-bridge","version":"0.1.1","keywords":["email","send-email","email-provider"],"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","_id":"mail-bridge@0.1.1","maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"homepage":"https://github.com/thtauhid/mail-bridge","bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"dist":{"shasum":"1b9c3f7fe75ed44862f79cdab241cc8be5ba57e0","tarball":"https://registry.npmjs.org/mail-bridge/-/mail-bridge-0.1.1.tgz","fileCount":6,"integrity":"sha512-CRUxGZsnfX7RhithsJwdf0WQQtA3kPYTJQQ8djdzANf+4D01cshGLZ5JhzBl0sa3O+tPNEowHhzE6SvZoDQ2Xg==","signatures":[{"sig":"MEYCIQCXWbSP5E4cQpSHQbGr5dQhArAmZbAFUVx4H4tcPmNOeAIhAPSqD+oBZ3NXFqyGbQlLg495dOGowWAJxkeB+m4VBcy5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25995},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"181ce7e13043752dd13e119702d27ef837e9feb7","scripts":{"dev":"tsnd --respawn src/index.ts","lint":"tsc","test":"tsnd --respawn test/index.ts","build":"tsup src/index.ts --format esm,cjs --dts","start":"node build/index.js","prepublishOnly":"pnpm build"},"_npmUser":{"name":"thtauhid","email":"thtauhid.71@gmail.com"},"repository":{"url":"git+https://github.com/thtauhid/mail-bridge.git","type":"git"},"_npmVersion":"10.2.4","description":"Send email using any email provider.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"resend":"^3.2.0","form-data":"^4.0.0","mailgun.js":"^10.2.1","nodemailer":"^6.9.12","@aws-sdk/client-ses":"^3.529.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","dotenv":"^16.4.5","typescript":"^5.4.2","@types/node":"^20.11.25","ts-node-dev":"^2.0.0","@types/react":"^18.2.64","@types/nodemailer":"^6.4.14"},"_npmOperationalInternal":{"tmp":"tmp/mail-bridge_0.1.1_1710096014207_0.8201035888037276","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"mail-bridge","version":"0.1.2","keywords":["email","send-email","email-provider"],"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","_id":"mail-bridge@0.1.2","maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"homepage":"https://github.com/thtauhid/mail-bridge","bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"dist":{"shasum":"1fd715653002d12ba003791f1886bb5570c6f103","tarball":"https://registry.npmjs.org/mail-bridge/-/mail-bridge-0.1.2.tgz","fileCount":6,"integrity":"sha512-OgJ/brs8ZT64Ngpe3NSYFLZCphIRn2FNkpuuA252VOICYcdyw1Em2u/tMgFtDl3YvXxZLuXDkmft6X2ECsD8lg==","signatures":[{"sig":"MEQCIFRKUgbaXooTk/LIh85Yp5m135ozM8+nk8F2Fhpg/tqXAiAT5UatmRKxRZdJGKUWUAUksucOCwmtV8bFXbC0TJLRDw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32748},"main":"./dist/index.js","_from":"file:mail-bridge-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","scripts":{"dev":"tsnd --respawn src/index.ts","lint":"tsc","test":"tsnd --respawn test/index.ts","build":"tsup src/index.ts --format esm,cjs --dts","start":"node build/index.js"},"_npmUser":{"name":"thtauhid","email":"thtauhid.71@gmail.com"},"_resolved":"C:\\Users\\tht\\AppData\\Local\\Temp\\4c3e13f923724b86410d73aebf3ae2e4\\mail-bridge-0.1.2.tgz","_integrity":"sha512-OgJ/brs8ZT64Ngpe3NSYFLZCphIRn2FNkpuuA252VOICYcdyw1Em2u/tMgFtDl3YvXxZLuXDkmft6X2ECsD8lg==","repository":{"url":"git+https://github.com/thtauhid/mail-bridge.git","type":"git"},"_npmVersion":"10.2.4","description":"Send email using any email provider.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"resend":"^3.2.0","form-data":"^4.0.0","mailgun.js":"^10.2.1","nodemailer":"^6.9.12","@aws-sdk/client-ses":"^3.529.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","dotenv":"^16.4.5","typescript":"^5.4.2","@types/node":"^20.11.25","ts-node-dev":"^2.0.0","@types/react":"^18.2.64","@types/nodemailer":"^6.4.14"},"_npmOperationalInternal":{"tmp":"tmp/mail-bridge_0.1.2_1710100057108_0.8371347198442365","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"mail-bridge","version":"1.0.0","keywords":["email","send-email","email-provider"],"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","_id":"mail-bridge@1.0.0","maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"homepage":"https://github.com/thtauhid/mail-bridge","bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"dist":{"shasum":"b29ee9b56f07c07f4a51964ace74e6ce72c5a1b6","tarball":"https://registry.npmjs.org/mail-bridge/-/mail-bridge-1.0.0.tgz","fileCount":6,"integrity":"sha512-40uwCqNyqSDHFgubjP/xvi9pHJMU3DrtRV83svokG4HLgfDJ2FcmNkB/Q3FMB8c/c9YaweK4vagfAOxQFBqreQ==","signatures":[{"sig":"MEQCIEsSLR48hH/GTzByJwSiKJolv1Ax3PkY0TL+/a1zF6zOAiB8MPR0vfv8a9GXT+KymRiMfM1o1EszzB7h6fQZIkMELg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37519},"main":"./dist/index.js","_from":"file:mail-bridge-1.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","scripts":{"dev":"tsnd --respawn src/index.ts","lint":"tsc","test":"tsnd --respawn test/index.ts","build":"tsup src/index.ts --format esm,cjs --dts","start":"node build/index.js"},"_npmUser":{"name":"thtauhid","email":"thtauhid.71@gmail.com"},"_resolved":"C:\\Users\\tht\\AppData\\Local\\Temp\\05ba152b4309f36dd3945053fecb8fd0\\mail-bridge-1.0.0.tgz","_integrity":"sha512-40uwCqNyqSDHFgubjP/xvi9pHJMU3DrtRV83svokG4HLgfDJ2FcmNkB/Q3FMB8c/c9YaweK4vagfAOxQFBqreQ==","repository":{"url":"git+https://github.com/thtauhid/mail-bridge.git","type":"git"},"_npmVersion":"10.2.4","description":"Send email using any email provider.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"resend":"^3.2.0","form-data":"^4.0.0","mailgun.js":"^10.2.1","nodemailer":"^6.9.12","@aws-sdk/client-ses":"^3.529.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","dotenv":"^16.4.5","typescript":"^5.4.2","@types/node":"^20.11.25","ts-node-dev":"^2.0.0","@types/react":"^18.2.64","@types/nodemailer":"^6.4.14"},"_npmOperationalInternal":{"tmp":"tmp/mail-bridge_1.0.0_1710245882815_0.553401763638319","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"mail-bridge","version":"1.0.1","keywords":["email","send-email","email-provider"],"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","_id":"mail-bridge@1.0.1","maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"homepage":"https://github.com/thtauhid/mail-bridge","bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"dist":{"shasum":"b70315eeaacb83333a679fc842895143d77a0f88","tarball":"https://registry.npmjs.org/mail-bridge/-/mail-bridge-1.0.1.tgz","fileCount":6,"integrity":"sha512-VLNORYDDazsT+5WkkxO2/NDcsW4CP9/N4mh78pMLUoYDKjL/FIU1qqRdOmj6F2b9FJfL0FA5RWYMckUW4HfIBA==","signatures":[{"sig":"MEQCIH12o8wGSZKNTzF+z+jtr4pvMe0vloM2TQ3CxuBIQs3CAiAyQJU9UnMtvl1DIplQo+7s74c2Qr2Flb2l3xhwHUavGg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34246},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"1ffd75452ee6f278f92b2c2a9535947851444616","scripts":{"dev":"tsnd --respawn src/index.ts","lint":"tsc","test":"tsnd --respawn test/index.ts","build":"tsup src/index.ts --format esm,cjs --dts","start":"node build/index.js","prepublishOnly":"pnpm build"},"_npmUser":{"name":"thtauhid","email":"thtauhid.71@gmail.com"},"repository":{"url":"git+https://github.com/thtauhid/mail-bridge.git","type":"git"},"_npmVersion":"10.2.4","description":"Send email using any email provider.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"resend":"^3.2.0","form-data":"^4.0.0","mailgun.js":"^10.2.1","nodemailer":"^6.9.12","@aws-sdk/client-ses":"^3.529.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","dotenv":"^16.4.5","typescript":"^5.4.2","@types/node":"^20.11.25","ts-node-dev":"^2.0.0","@types/react":"^18.2.64","@types/nodemailer":"^6.4.14"},"_npmOperationalInternal":{"tmp":"tmp/mail-bridge_1.0.1_1712908809178_0.5235846587254038","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"mail-bridge","version":"1.0.2","description":"Send email using any email provider.","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","keywords":["email","send-email","email-provider"],"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","homepage":"https://github.com/thtauhid/mail-bridge","repository":{"type":"git","url":"git+https://github.com/thtauhid/mail-bridge.git"},"devDependencies":{"@types/node":"^20.11.25","@types/nodemailer":"^6.4.14","@types/react":"^18.2.64","dotenv":"^16.4.5","ts-node-dev":"^2.0.0","tsup":"^8.0.2","typescript":"^5.4.2"},"dependencies":{"@aws-sdk/client-ses":"^3.529.1","form-data":"^4.0.0","mailgun.js":"^10.2.1","nodemailer":"^6.9.12","resend":"^3.2.0"},"scripts":{"start":"node build/index.js","dev":"tsnd --respawn src/index.ts","lint":"tsc","test":"tsnd --respawn test/index.ts","build":"tsup src/index.ts --format esm,cjs --dts"},"_id":"mail-bridge@1.0.2","bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"_integrity":"sha512-FUwpLuYKzJhNt7txo7aYITv1wKVJFiOoliJSRtwMwlevdlEKdSgEiKOrKjrs67dgkWtf618e35GedmXKt/45XQ==","_resolved":"/tmp/78be9453827962b43a877361892abf05/mail-bridge-1.0.2.tgz","_from":"file:mail-bridge-1.0.2.tgz","_nodeVersion":"22.4.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-FUwpLuYKzJhNt7txo7aYITv1wKVJFiOoliJSRtwMwlevdlEKdSgEiKOrKjrs67dgkWtf618e35GedmXKt/45XQ==","shasum":"0799c8cc7d3df4606ebaec3d8c380946be7f90d2","tarball":"https://registry.npmjs.org/mail-bridge/-/mail-bridge-1.0.2.tgz","fileCount":6,"unpackedSize":37519,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBAKoHdGlQrBiLr5z4yWcSg97pslDDRCFJhyJB2oFJCQAiEAulxTvnLX42kDxA3W6g5JIAcjNt06rL0n6yH8YyvF4r8="}]},"_npmUser":{"name":"thtauhid","email":"thtauhid.71@gmail.com"},"directories":{},"maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mail-bridge_1.0.2_1720532318156_0.3531054688695079"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-08T11:10:03.008Z","modified":"2024-07-09T13:38:38.512Z","0.0.1":"2024-03-08T11:10:03.168Z","0.0.2":"2024-03-08T11:12:19.854Z","0.0.3":"2024-03-08T11:17:47.847Z","0.0.4":"2024-03-08T11:33:57.699Z","0.0.5":"2024-03-08T14:02:00.754Z","0.0.6":"2024-03-10T05:50:45.649Z","0.0.7":"2024-03-10T07:17:25.364Z","0.0.8":"2024-03-10T07:56:17.232Z","0.0.9":"2024-03-10T08:31:37.899Z","0.0.10":"2024-03-10T11:07:53.103Z","0.0.11":"2024-03-10T11:16:38.092Z","0.1.0":"2024-03-10T17:47:23.317Z","0.1.1":"2024-03-10T18:40:14.357Z","0.1.2":"2024-03-10T19:47:37.267Z","1.0.0":"2024-03-12T12:18:02.951Z","1.0.1":"2024-04-12T08:00:09.316Z","1.0.2":"2024-07-09T13:38:38.349Z"},"bugs":{"url":"https://github.com/thtauhid/mail-bridge/issues"},"author":{"name":"Tasnimul H. Tauhid"},"license":"MIT","homepage":"https://github.com/thtauhid/mail-bridge","keywords":["email","send-email","email-provider"],"repository":{"type":"git","url":"git+https://github.com/thtauhid/mail-bridge.git"},"description":"Send email using any email provider.","maintainers":[{"name":"thtauhid","email":"thtauhid.71@gmail.com"}],"readme":"# Mail Bridge\n\n## Description\n\nSend email using any email provider.\n\n## Features\n\n- Send email using multiple email providers.\n- Automatically switch to the next provider if the current provider fails.\n- Simple and easy to use API.\n- Set the priority of the email providers.\n\n## Email Providers\n\n| Provider | Support              | Comment                               |\n| -------- | -------------------- | ------------------------------------- |\n| SMTP     | ✅                   | Uses nodemailer                       |\n| Resend   | ✅                   | Uses official resend package          |\n| Mailgun  | ✅                   | Uses official mailgun.js package      |\n| Brevo    | ✅                   | Uses SMTP (nodemailer) under the hood |\n| Gmail    | ✅                   | Uses SMTP (nodemailer) under the hood |\n| Outlook  | ✅                   | Uses SMTP (nodemailer) under the hood |\n| AWS SES  | Under Implementation |                                       |\n| Mailjet  | Planned              |                                       |\n| Loops    | Planned              |                                       |\n| SendGrid | ❌                   |                                       |\n\n## Installation\n\n```bash\nnpm install mail-bridge\n```\n\n## Usage\n\nFirst, you need to import the `MailBridge` class.\n\n```javascript\nconst { MailBridge } = require(\"mail-bridge\"); // CommonJS\nimport { MailBridge } from \"mail-bridge\"; // ES6\n```\n\nThen, you need to create an instance of the `MailBridge` class.\n\n```javascript\nconst mailBridge = new MailBridge({\n  // First, you need to provide the configuration for the email providers.\n  // You can provide the configuration for single or multiple providers.\n  // Use environment variables or .env file to store sensitive information.\n  config: {\n    // AWS SES\n    aws_ses: {\n      region: \"us-west-2\",\n    },\n    // Brevo\n    brevo: {\n      host: \"smtp-relay.brevo.com\",\n      port: 587,\n      auth: {\n        user: \"user\",\n        pass: \"pass\",\n      },\n    },\n    // Gmail\n    gmail: {\n      host: \"smtp.gmail.com\",\n      port: 587,\n      auth: {\n        user: \"user\",\n        pass: \"pass\",\n      },\n    },\n    // Mailgun\n    mailgun: {\n      api_key: \"key-1234\",\n      domain: \"example.com\",\n    },\n    // Resend\n    resend: {\n      api_key: \"1234\",\n    },\n    // Outlook\n    outlook: {\n      host: \"smtp-mail.outlook.com\",\n      port: 587,\n      auth: {\n        user: \"user\",\n        pass: \"pass\",\n      },\n    },\n    // SMTP\n    smtp: {\n      host: \"smtp.example.com\",\n      port: 587,\n      auth: {\n        user: \"user\",\n        pass: \"pass\",\n      },\n    },\n  },\n\n  // Then, you need to provide the default \"from\" email address.\n  defaultFrom: \"info@example.com\",\n\n  // Optionally, you can provide the priority of the email providers (if you have configures multiple providers).\n  // You don't need to provide the priority if you have configured only one provider.\n  // It's not mandatory to provide the priority of all the providers.\n  // If you don't provide the priority of a provider, it will be considered as the lowest priority.\n  priority: [\"resend\", \"brevo\", \"aws_ses\", \"smtp\", \"mailgun\"],\n\n  // Optionally, you can provide the default retry count for all the emails.\n  // If you don't provide the retry count, the numbers of providers\n  // defined in the 'config' will be used as the default retry count.\n  retryCount: 3,\n});\n```\n\nFinally, you can send an email using the `send` method.\n\n```javascript\n// You can use async/await\nconst mail = await mailBridge.send(\n  {\n    // \"from\" is optional. If not provided, the default \"from\" email address will be used.\n    from: \"sender-email\",\n    to: \"recipient-email\",\n    subject: \"Email Subject\",\n    text: \"Email Body\",\n  },\n  // Optionally you can pass a provider and rety count as the second parameter\n  {\n    provider: \"resend\", // Optional. Puts the provider in the first priority.\n    retryCount: 3, // Optional. Overrides the default retry count for the specific email.\n  }\n);\n\nconsole.log(mail);\n```\n\n```javascript\n// Or you can use Promise(.then, .catch, .finally)\nmailBridge\n  .send(\n    {\n      // \"from\" is optional. If not provided, the default \"from\" email address will be used.\n      from: \"sender-email\",\n      to: \"recipient-email\",\n      subject: \"Email Subject\",\n      text: \"Email Body\",\n    },\n    // Optionally you can pass a provider and rety count as the second parameter\n    {\n      provider: \"resend\", // Optional. Puts the provider in the first priority.\n      retryCount: 3, // Optional. Overrides the default retry count for the specific email.\n    }\n  )\n  .then((res) => {\n    console.log(res);\n  })\n  .catch((err) => {\n    console.error(err);\n  })\n  .finally(() => {\n    console.log(\"done\");\n  });\n```\n\n## Type Definitions\n\n```typescript\nexport type EMAIL = {\n  to: string | string[];\n  from?: string;\n  subject: string;\n  text: string;\n};\n\nexport type PROVIDER =\n  | \"aws_ses\"\n  | \"brevo\"\n  | \"gmail\"\n  | \"mailgun\"\n  | \"outlook\"\n  | \"resend\"\n  | \"smtp\";\n\nexport type CONFIG = {\n  aws_ses?: {\n    region: string;\n  };\n  brevo?: Transporter;\n  gmail?: Transporter;\n  mailgun?: {\n    api_key: string;\n    domain: string;\n  };\n  outlook?: Transporter;\n  resend?: {\n    api_key: string;\n  };\n  smtp?: Transporter;\n};\n\nexport type EMAIL_SENT_RESPONSE = {\n  provider: PROVIDER;\n  time: any; // Date time\n  id?: string;\n  email: EMAIL;\n};\n\nexport type EMAIL_SENT_FAILURE = {\n  provider: PROVIDER;\n  time: any; // Date time\n  error: string;\n};\n\n// SMTP\nexport type Transporter = {\n  host: string;\n  port: number;\n  auth: {\n    user: string;\n    pass: string;\n  };\n};\n```\n\n## Contributing\n\nContributions are welcome. Please open an issue or a pull request.\n","readmeFilename":"README.md"}