@h3ravel/mail 8.0.7 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +165 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -7
- package/dist/index.d.ts +72 -7
- package/dist/index.js +160 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,10 +31,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var src_exports = {};
|
|
33
33
|
__export(src_exports, {
|
|
34
|
+
LOGDriver: () => LOGDriver,
|
|
34
35
|
MailServiceProvider: () => MailServiceProvider,
|
|
35
36
|
Mailable: () => Mailable,
|
|
36
37
|
Mailer: () => Mailer,
|
|
37
|
-
|
|
38
|
+
SESDriver: () => SESDriver,
|
|
39
|
+
SMTPDriver: () => SMTPDriver,
|
|
40
|
+
SendMailDriver: () => SendMailDriver,
|
|
41
|
+
Service: () => Service
|
|
38
42
|
});
|
|
39
43
|
module.exports = __toCommonJS(src_exports);
|
|
40
44
|
|
|
@@ -125,19 +129,50 @@ var Mailer = class {
|
|
|
125
129
|
if (options.viewPath && !options.html) {
|
|
126
130
|
options.html = await this.edgeRenderer(options.viewPath, options.viewData || {});
|
|
127
131
|
}
|
|
128
|
-
|
|
132
|
+
try {
|
|
133
|
+
return this.driver.send(options);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
138
|
};
|
|
131
139
|
|
|
132
|
-
// src/Drivers/
|
|
140
|
+
// src/Drivers/SESDriver.ts
|
|
133
141
|
var import_nodemailer = __toESM(require("nodemailer"), 1);
|
|
142
|
+
var SESDriver = class {
|
|
143
|
+
static {
|
|
144
|
+
__name(this, "SESDriver");
|
|
145
|
+
}
|
|
146
|
+
transporter;
|
|
147
|
+
constructor(config) {
|
|
148
|
+
this.transporter = import_nodemailer.default.createTransport({
|
|
149
|
+
SES: config.SES,
|
|
150
|
+
maxConnections: config.maxConnections,
|
|
151
|
+
sendingRate: config.sendingRate
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async send(options) {
|
|
155
|
+
return await this.transporter.sendMail({
|
|
156
|
+
to: options.to,
|
|
157
|
+
cc: options.cc,
|
|
158
|
+
bcc: options.bcc,
|
|
159
|
+
subject: options.subject,
|
|
160
|
+
html: options.html,
|
|
161
|
+
text: options.text,
|
|
162
|
+
attachments: options.attachments
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// src/Drivers/SMTPDriver.ts
|
|
168
|
+
var import_nodemailer2 = __toESM(require("nodemailer"), 1);
|
|
134
169
|
var SMTPDriver = class {
|
|
135
170
|
static {
|
|
136
171
|
__name(this, "SMTPDriver");
|
|
137
172
|
}
|
|
138
173
|
transporter;
|
|
139
174
|
constructor(config) {
|
|
140
|
-
this.transporter =
|
|
175
|
+
this.transporter = import_nodemailer2.default.createTransport({
|
|
141
176
|
host: config.host,
|
|
142
177
|
port: config.port,
|
|
143
178
|
secure: config.port === 465,
|
|
@@ -160,29 +195,137 @@ var SMTPDriver = class {
|
|
|
160
195
|
}
|
|
161
196
|
};
|
|
162
197
|
|
|
163
|
-
// src/
|
|
164
|
-
var
|
|
165
|
-
var
|
|
198
|
+
// src/Drivers/LOGDriver.ts
|
|
199
|
+
var import_nodemailer3 = __toESM(require("nodemailer"), 1);
|
|
200
|
+
var import_stream = __toESM(require("stream"), 1);
|
|
201
|
+
var LOGDriver = class {
|
|
166
202
|
static {
|
|
167
|
-
__name(this, "
|
|
203
|
+
__name(this, "LOGDriver");
|
|
168
204
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
205
|
+
transporter;
|
|
206
|
+
constructor(_config) {
|
|
207
|
+
this.transporter = import_nodemailer3.default.createTransport({
|
|
208
|
+
streamTransport: true,
|
|
209
|
+
newline: "unix"
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
async send(options) {
|
|
213
|
+
this.transporter.sendMail(options, (err, info) => {
|
|
214
|
+
if (err)
|
|
215
|
+
throw err;
|
|
216
|
+
console.log(info.envelope);
|
|
217
|
+
console.log(info.messageId);
|
|
218
|
+
info.message instanceof import_stream.default.Readable && info.message.pipe(process.stdout);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// src/Drivers/SendMailDriver.ts
|
|
224
|
+
var import_nodemailer4 = __toESM(require("nodemailer"), 1);
|
|
225
|
+
var SendMailDriver = class {
|
|
226
|
+
static {
|
|
227
|
+
__name(this, "SendMailDriver");
|
|
228
|
+
}
|
|
229
|
+
transporter;
|
|
230
|
+
constructor(config) {
|
|
231
|
+
this.transporter = import_nodemailer4.default.createTransport({
|
|
232
|
+
sendmail: true,
|
|
233
|
+
path: config.path
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
async send(options) {
|
|
237
|
+
return await this.transporter.sendMail({
|
|
238
|
+
to: options.to,
|
|
239
|
+
cc: options.cc,
|
|
240
|
+
bcc: options.bcc,
|
|
241
|
+
subject: options.subject,
|
|
242
|
+
html: options.html,
|
|
243
|
+
text: options.text,
|
|
244
|
+
attachments: options.attachments
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// src/Service.ts
|
|
250
|
+
var Service = class {
|
|
251
|
+
static {
|
|
252
|
+
__name(this, "Service");
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Initializes the mailer service with the given application instance
|
|
256
|
+
*
|
|
257
|
+
* @param app
|
|
258
|
+
* @returns
|
|
259
|
+
*/
|
|
260
|
+
static init(app) {
|
|
261
|
+
const view = app.make("view");
|
|
262
|
+
const config = app.make("config");
|
|
263
|
+
const mailConfig = {
|
|
264
|
+
/**
|
|
265
|
+
* SMTP configuration with fallback defaults
|
|
266
|
+
*/
|
|
267
|
+
smtp: {
|
|
175
268
|
host: config.get("mail.mailers.smtp.host", "smtp.mailtrap.io"),
|
|
176
269
|
port: Number(config.get("mail.mailers.smtp.port", 2525)),
|
|
177
270
|
auth: {
|
|
178
271
|
user: config.get("mail.mailers.smtp.username", ""),
|
|
179
272
|
pass: config.get("mail.mailers.smtp.password", "")
|
|
180
273
|
},
|
|
181
|
-
opportunisticTLS: config.get("mail.
|
|
274
|
+
opportunisticTLS: config.get("mail.mail\u6C14\u7684mailers.smtp.encryption") === "tls",
|
|
182
275
|
connectionTimeout: config.get("mail.mailers.smtp.timeout"),
|
|
183
276
|
debug: false
|
|
184
|
-
}
|
|
185
|
-
|
|
277
|
+
},
|
|
278
|
+
/**
|
|
279
|
+
* SES configuration with fallback defaults
|
|
280
|
+
*/
|
|
281
|
+
ses: {
|
|
282
|
+
SES: config.get("mail.mailers.ses.transport", "ses"),
|
|
283
|
+
maxConnections: config.get("mail.mailers.ses.connections", 10),
|
|
284
|
+
sendingRate: config.get("mail.mailers.ses.rate", 5)
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* Sendmail configuration with fallback default path
|
|
288
|
+
*/
|
|
289
|
+
sendmail: {
|
|
290
|
+
path: config.get("mail.mailers.sendmail.path", "sendmail")
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
const driver = {
|
|
294
|
+
/**
|
|
295
|
+
* SES driver factory
|
|
296
|
+
* @returns
|
|
297
|
+
*/
|
|
298
|
+
ses: () => new SESDriver(mailConfig.ses),
|
|
299
|
+
/**
|
|
300
|
+
* SMTP driver factory
|
|
301
|
+
* @returns
|
|
302
|
+
*/
|
|
303
|
+
smtp: () => new SMTPDriver(mailConfig.smtp),
|
|
304
|
+
/**
|
|
305
|
+
* LOG driver factory for debugging
|
|
306
|
+
* @returns
|
|
307
|
+
*/
|
|
308
|
+
log: () => new LOGDriver(mailConfig.smtp),
|
|
309
|
+
/**
|
|
310
|
+
* Sendmail driver factory
|
|
311
|
+
* @returns
|
|
312
|
+
*/
|
|
313
|
+
sendmail: () => new SendMailDriver(mailConfig.sendmail)
|
|
314
|
+
};
|
|
315
|
+
return new Mailer((driver[config.get("mail.default")] ?? driver.smtp)(), async (viewPath, data) => await view(viewPath, data));
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// src/Providers/MailServiceProvider.ts
|
|
320
|
+
var import_core = require("@h3ravel/core");
|
|
321
|
+
var MailServiceProvider = class extends import_core.ServiceProvider {
|
|
322
|
+
static {
|
|
323
|
+
__name(this, "MailServiceProvider");
|
|
324
|
+
}
|
|
325
|
+
static priority = 990;
|
|
326
|
+
register() {
|
|
327
|
+
this.app.singleton(Mailer, () => {
|
|
328
|
+
return Service.init(this.app);
|
|
186
329
|
});
|
|
187
330
|
}
|
|
188
331
|
boot() {
|
|
@@ -190,9 +333,13 @@ var MailServiceProvider = class extends import_core.ServiceProvider {
|
|
|
190
333
|
};
|
|
191
334
|
// Annotate the CommonJS export names for ESM import in node:
|
|
192
335
|
0 && (module.exports = {
|
|
336
|
+
LOGDriver,
|
|
193
337
|
MailServiceProvider,
|
|
194
338
|
Mailable,
|
|
195
339
|
Mailer,
|
|
196
|
-
|
|
340
|
+
SESDriver,
|
|
341
|
+
SMTPDriver,
|
|
342
|
+
SendMailDriver,
|
|
343
|
+
Service
|
|
197
344
|
});
|
|
198
345
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Mailable.ts","../src/Mailer.ts","../src/Drivers/SMTPDriver.ts","../src/Providers/MailServiceProvider.ts"],"sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from './Helpers';\nexport * from './Mailable';\nexport * from './Mailer';\nexport * from './Contracts/Mailer';\nexport * from './Drivers/SES';\nexport * from './Drivers/SMTPDriver';\nexport * from './Providers/MailServiceProvider';\n","import type { SendMailOptions } from \"./Contracts/Mailer\";\n\nexport abstract class Mailable {\n protected toAddress?: string;\n protected ccAddresses?: string[];\n protected bccAddresses?: string[];\n protected subjectText?: string;\n protected htmlContent?: string;\n protected textContent?: string;\n protected viewPath?: string;\n protected viewData?: Record<string, any>;\n protected attachmentsList?: SendMailOptions['attachments'];\n\n to (address: string) {\n this.toAddress = address;\n return this;\n }\n\n cc (...addresses: string[]) {\n this.ccAddresses = addresses;\n return this;\n }\n\n bcc (...addresses: string[]) {\n this.bccAddresses = addresses;\n return this;\n }\n\n subject (subject: string) {\n this.subjectText = subject;\n return this;\n }\n\n html (html: string) {\n this.htmlContent = html;\n return this;\n }\n\n text (text: string) {\n this.textContent = text;\n return this;\n }\n\n view (path: string, data: Record<string, any> = {}) {\n this.viewPath = path;\n this.viewData = data;\n return this;\n }\n\n attach (filename: string, filePath: string) {\n if (!this.attachmentsList) this.attachmentsList = [];\n this.attachmentsList.push({ filename, path: filePath });\n return this;\n }\n\n /**\n * Child classes should define build() like in Laravel\n */\n abstract build (): Promise<this> | this;\n\n /**\n * Called internally by Mailer\n */\n getMessageOptions (): SendMailOptions {\n return {\n to: this.toAddress,\n cc: this.ccAddresses,\n bcc: this.bccAddresses,\n subject: this.subjectText,\n html: this.htmlContent,\n text: this.textContent,\n viewPath: this.viewPath,\n viewData: this.viewData,\n attachments: this.attachmentsList\n };\n }\n}\n","import { MailDriverContract } from './Contracts/Mailer';\nimport { Mailable } from './Mailable';\n\nexport class Mailer {\n constructor(\n private driver: MailDriverContract,\n private edgeRenderer: (viewPath: string, data: Record<string, any>) => Promise<string>\n ) { }\n\n async send (mailable: Mailable) {\n await mailable.build();\n\n const options = mailable.getMessageOptions();\n\n if (options.viewPath && !options.html) {\n options.html = await this.edgeRenderer(options.viewPath, options.viewData || {});\n }\n\n return this.driver.send(options);\n }\n}\n","import nodemailer, { type SendMailOptions, type TransportOptions } from 'nodemailer';\n\nimport { MailDriverContract, SMTPConfig } from '../Contracts/Mailer';\n\nexport class SMTPDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SMTPConfig) {\n this.transporter = nodemailer.createTransport({\n host: config.host,\n port: config.port,\n secure: config.port === 465, // auto decide based on port\n auth: {\n user: config.auth.user,\n pass: config.auth.pass\n }\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import { Mailer } from '../Mailer';\nimport { SMTPConfig } from '../Contracts/Mailer';\nimport { SMTPDriver } from '../Drivers/SMTPDriver';\nimport { ServiceProvider } from '@h3ravel/core';\n\n/**\n * Mail delivery setup.\n * \n * Bind Mailer service.\n * Load mail drivers (SMTP, SES, etc.).\n * Register Mail facade.\n * \n */\nexport class MailServiceProvider extends ServiceProvider {\n public static priority = 990;\n register () {\n /**\n * Register Mailer instance\n */\n\n this.app.singleton<any>('mailer', () => {\n // this.app.bind(Mailer, () => {\n const view = this.app.make('view');\n const config = this.app.make('config');\n\n const smtpConfig: SMTPConfig = {\n host: config.get('mail.mailers.smtp.host', 'smtp.mailtrap.io'),\n port: Number(config.get('mail.mailers.smtp.port', 2525)),\n auth: {\n user: config.get('mail.mailers.smtp.username', ''),\n pass: config.get('mail.mailers.smtp.password', ''),\n },\n opportunisticTLS: config.get('mail.mailers.smtp.encryption') === 'tls',\n connectionTimeout: config.get('mail.mailers.smtp.timeout'),\n debug: false,\n };\n\n return new Mailer(\n new SMTPDriver(smtpConfig),\n async (viewPath, data) => await view(viewPath, data)\n );\n });\n }\n\n boot () {\n /**\n * Add logic here for global mail \"from\" address and others\n */\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACEO,IAAeA,WAAf,MAAeA;EAAtB,OAAsBA;;;EACRC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EA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R;AACJ;","names":["Mailable","toAddress","ccAddresses","bccAddresses","subjectText","htmlContent","textContent","viewPath","viewData","attachmentsList","to","address","cc","addresses","bcc","subject","html","text","view","path","data","attach","filename","filePath","push","getMessageOptions","attachments","Mailer","driver","edgeRenderer","send","mailable","build","options","getMessageOptions","viewPath","html","viewData","SMTPDriver","transporter","config","nodemailer","createTransport","host","port","secure","auth","user","pass","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","MailServiceProvider","ServiceProvider","priority","register","app","singleton","view","make","config","smtpConfig","host","get","port","Number","auth","user","pass","opportunisticTLS","connectionTimeout","debug","Mailer","SMTPDriver","viewPath","data","boot"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Mailable.ts","../src/Mailer.ts","../src/Drivers/SESDriver.ts","../src/Drivers/SMTPDriver.ts","../src/Drivers/LOGDriver.ts","../src/Drivers/SendMailDriver.ts","../src/Service.ts","../src/Providers/MailServiceProvider.ts"],"sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from './Helpers';\nexport * from './Mailable';\nexport * from './Mailer';\nexport * from './Service';\nexport * from './Contracts/Mailer';\nexport * from './Drivers/LOGDriver';\nexport * from './Drivers/SESDriver';\nexport * from './Drivers/SMTPDriver';\nexport * from './Drivers/SendMailDriver';\nexport * from './Providers/MailServiceProvider';\n","import type { SendMailOptions } from \"./Contracts/Mailer\";\n\nexport abstract class Mailable {\n protected toAddress?: string;\n protected ccAddresses?: string[];\n protected bccAddresses?: string[];\n protected subjectText?: string;\n protected htmlContent?: string;\n protected textContent?: string;\n protected viewPath?: string;\n protected viewData?: Record<string, any>;\n protected attachmentsList?: SendMailOptions['attachments'];\n\n to (address: string) {\n this.toAddress = address;\n return this;\n }\n\n cc (...addresses: string[]) {\n this.ccAddresses = addresses;\n return this;\n }\n\n bcc (...addresses: string[]) {\n this.bccAddresses = addresses;\n return this;\n }\n\n subject (subject: string) {\n this.subjectText = subject;\n return this;\n }\n\n html (html: string) {\n this.htmlContent = html;\n return this;\n }\n\n text (text: string) {\n this.textContent = text;\n return this;\n }\n\n view (path: string, data: Record<string, any> = {}) {\n this.viewPath = path;\n this.viewData = data;\n return this;\n }\n\n attach (filename: string, filePath: string) {\n if (!this.attachmentsList) this.attachmentsList = [];\n this.attachmentsList.push({ filename, path: filePath });\n return this;\n }\n\n /**\n * Child classes should define build() like in Laravel\n */\n abstract build (): Promise<this> | this;\n\n /**\n * Called internally by Mailer\n */\n getMessageOptions (): SendMailOptions {\n return {\n to: this.toAddress,\n cc: this.ccAddresses,\n bcc: this.bccAddresses,\n subject: this.subjectText,\n html: this.htmlContent,\n text: this.textContent,\n viewPath: this.viewPath,\n viewData: this.viewData,\n attachments: this.attachmentsList\n };\n }\n}\n","import { DeliveryReport, MailDriverContract } from './Contracts/Mailer';\n\nimport { Mailable } from './Mailable';\n\nexport class Mailer {\n constructor(\n private driver: MailDriverContract,\n private edgeRenderer: (viewPath: string, data: Record<string, any>) => Promise<string>\n ) { }\n\n async send (mailable: Mailable): Promise<DeliveryReport | undefined | void> {\n await mailable.build();\n\n const options = mailable.getMessageOptions();\n\n if (options.viewPath && !options.html) {\n options.html = await this.edgeRenderer(options.viewPath, options.viewData || {});\n }\n\n try {\n return this.driver.send(options);\n } catch (error) {\n return\n }\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract, SESConfig } from '../Contracts/Mailer';\n\nexport class SESDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SESConfig) {\n this.transporter = nodemailer.createTransport({\n SES: config.SES,\n maxConnections: config.maxConnections,\n sendingRate: config.sendingRate\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract, SMTPConfig } from '../Contracts/Mailer';\n\nexport class SMTPDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SMTPConfig) {\n this.transporter = nodemailer.createTransport({\n host: config.host,\n port: config.port,\n secure: config.port === 465, // auto decide based on port\n auth: {\n user: config.auth.user,\n pass: config.auth.pass\n }\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract } from '../Contracts/Mailer';\nimport Stream from 'stream';\n\nexport class LOGDriver implements MailDriverContract {\n private transporter\n\n constructor(_config: any) {\n this.transporter = nodemailer.createTransport({\n streamTransport: true,\n newline: \"unix\",\n });\n }\n\n async send (options: SendMailOptions) {\n this.transporter.sendMail(options, (err, info) => {\n if (err) throw err;\n console.log(info.envelope);\n console.log(info.messageId);\n // Pipe the raw RFC 822 message to STDOUT\n info.message instanceof Stream.Readable && info.message.pipe(process.stdout);\n }\n );\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract, SendMailConfig } from '../Contracts/Mailer';\n\nexport class SendMailDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SendMailConfig) {\n this.transporter = nodemailer.createTransport({\n sendmail: true,\n path: config.path,\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import { Application } from \"@h3ravel/core\";\nimport { SendMailConfig, SESConfig, SMTPConfig } from \"./Contracts/Mailer\";\nimport { SESDriver } from \"./Drivers/SESDriver\";\nimport { SMTPDriver } from \"./Drivers/SMTPDriver\";\nimport { LOGDriver } from \"./Drivers/LOGDriver\";\nimport { SendMailDriver } from \"./Drivers/SendMailDriver\";\nimport { Mailer } from \"./Mailer\";\n\n/**\n * Service class to initialize and configure the mailer service\n */\nexport class Service {\n /**\n * Initializes the mailer service with the given application instance\n * \n * @param app \n * @returns \n */\n static init (app: Application) {\n /**\n * Resolve the view and config services from the container\n */\n const view = app.make('view');\n const config = app.make('config');\n\n /**\n * Configure mailer settings for different drivers\n */\n const mailConfig = {\n /**\n * SMTP configuration with fallback defaults\n */\n smtp: <SMTPConfig>{\n host: config.get('mail.mailers.smtp.host', 'smtp.mailtrap.io'),\n port: Number(config.get('mail.mailers.smtp.port', 2525)),\n auth: {\n user: config.get('mail.mailers.smtp.username', ''),\n pass: config.get('mail.mailers.smtp.password', ''),\n },\n opportunisticTLS: config.get('mail.mail气的mailers.smtp.encryption') === 'tls',\n connectionTimeout: config.get('mail.mailers.smtp.timeout'),\n debug: false,\n },\n /**\n * SES configuration with fallback defaults\n */\n ses: <SESConfig>{\n SES: config.get('mail.mailers.ses.transport', 'ses'),\n maxConnections: config.get('mail.mailers.ses.connections', 10),\n sendingRate: config.get('mail.mailers.ses.rate', 5),\n },\n /**\n * Sendmail configuration with fallback default path\n */\n sendmail: <SendMailConfig>{\n path: config.get('mail.mailers.sendmail.path', 'sendmail'),\n },\n };\n\n /**\n * Define available mail drivers\n */\n const driver = {\n /**\n * SES driver factory\n * @returns \n */\n ses: () => new SESDriver(mailConfig.ses),\n /**\n * SMTP driver factory\n * @returns \n */\n smtp: () => new SMTPDriver(mailConfig.smtp),\n /**\n * LOG driver factory for debugging\n * @returns \n */\n log: () => new LOGDriver(mailConfig.smtp),\n /**\n * Sendmail driver factory\n * @returns \n */\n sendmail: () => new SendMailDriver(mailConfig.sendmail),\n };\n\n /**\n * Initialize Mailer with the selected driver (default to SMTP if not specified)\n * and a view rendering function\n */\n return new Mailer(\n (driver[config.get('mail.default') as keyof typeof driver] ?? driver.smtp)(),\n async (viewPath, data) => await view(viewPath, data)\n );\n }\n}\n","import { SESConfig, SMTPConfig, SendMailConfig } from '../Contracts/Mailer';\n\nimport { LOGDriver } from '../Drivers/LOGDriver';\nimport { Mailer } from '../Mailer';\nimport { SESDriver } from '../Drivers/SESDriver';\nimport { SMTPDriver } from '../Drivers/SMTPDriver';\nimport { SendMailDriver } from '../Drivers/SendMailDriver';\nimport { Service } from '../Service';\nimport { ServiceProvider } from '@h3ravel/core';\n\n/**\n * Mail delivery setup.\n * \n * Bind Mailer service.\n * Load mail drivers (SMTP, SES, etc.).\n * Register Mail facade.\n * \n */\nexport class MailServiceProvider extends ServiceProvider {\n public static priority = 990;\n register () {\n /**\n * Register Mailer instance\n */\n this.app.singleton<any>(Mailer, () => {\n return Service.init(this.app)\n });\n }\n\n boot () {\n /**\n * Add logic here for global mail \"from\" address and others\n */\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;ACEO,IAAeA,WAAf,MAAeA;EAAtB,OAAsBA;;;EACRC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EAEVC,GAAIC,SAAiB;AACjB,SAAKV,YAAYU;AACjB,WAAO;EACX;EAEAC,MAAOC,WAAqB;AACxB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,OAAQD,WAAqB;AACzB,SAAKV,eAAeU;AACpB,WAAO;EACX;EAEAE,QAASA,SAAiB;AACtB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMA,MAAc;AAChB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMA,MAAc;AAChB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMC,MAAcC,OAA4B,CAAC,GAAG;AAChD,SAAKb,WAAWY;AAChB,SAAKX,WAAWY;AAChB,WAAO;EACX;EAEAC,OAAQC,UAAkBC,UAAkB;AACxC,QAAI,CAAC,KAAKd;AAAiB,WAAKA,kBAAkB,CAAA;AAClD,SAAKA,gBAAgBe,KAAK;MAAEF;MAAUH,MAAMI;IAAS,CAAA;AACrD,WAAO;EACX;;;;EAUAE,oBAAsC;AAClC,WAAO;MACHf,IAAI,KAAKT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A;EAfzC,OAeyCA;;;EACrC,OAAcC,WAAW;EACzBC,WAAY;AAIR,SAAKC,IAAIC,UAAeC,QAAQ,MAAA;AAC5B,aAAOC,QAAQC,KAAK,KAAKJ,GAAG;IAChC,CAAA;EACJ;EAEAK,OAAQ;EAIR;AACJ;","names":["Mailable","toAddress","ccAddresses","bccAddresses","subjectText","htmlContent","textContent","viewPath","viewData","attachmentsList","to","address","cc","addresses","bcc","subject","html","text","view","path","data","attach","filename","filePath","push","getMessageOptions","attachments","Mailer","driver","edgeRenderer","send","mailable","build","options","getMessageOptions","viewPath","html","viewData","error","SESDriver","transporter","config","nodemailer","createTransport","SES","maxConnections","sendingRate","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","import_nodemailer","SMTPDriver","transporter","config","nodemailer","createTransport","host","port","secure","auth","user","pass","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","import_nodemailer","LOGDriver","transporter","_config","nodemailer","createTransport","streamTransport","newline","send","options","sendMail","err","info","console","log","envelope","messageId","message","Stream","Readable","pipe","process","stdout","import_nodemailer","SendMailDriver","transporter","config","nodemailer","createTransport","sendmail","path","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","Service","init","app","view","make","config","mailConfig","smtp","host","get","port","Number","auth","user","pass","opportunisticTLS","connectionTimeout","debug","ses","SES","maxConnections","sendingRate","sendmail","path","driver","SESDriver","SMTPDriver","log","LOGDriver","SendMailDriver","Mailer","viewPath","data","MailServiceProvider","ServiceProvider","priority","register","app","singleton","Mailer","Service","init","boot"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,22 +1,56 @@
|
|
|
1
|
-
import { SendMailOptions as SendMailOptions$1 } from 'nodemailer';
|
|
1
|
+
import { SendMailOptions as SendMailOptions$1, SentMessageInfo } from 'nodemailer';
|
|
2
|
+
import * as SESConnection from 'nodemailer/lib/ses-transport';
|
|
3
|
+
import SESConnection__default from 'nodemailer/lib/ses-transport';
|
|
2
4
|
import SMTPConnection from 'nodemailer/lib/smtp-connection';
|
|
5
|
+
import * as SendmailTransport from 'nodemailer/lib/sendmail-transport';
|
|
6
|
+
import SendmailTransport__default from 'nodemailer/lib/sendmail-transport';
|
|
7
|
+
import { Application, ServiceProvider } from '@h3ravel/core';
|
|
3
8
|
import * as nodemailer_lib_smtp_transport from 'nodemailer/lib/smtp-transport';
|
|
4
|
-
import { ServiceProvider } from '@h3ravel/core';
|
|
5
9
|
|
|
10
|
+
interface DeliveryReport {
|
|
11
|
+
accepted: string[];
|
|
12
|
+
rejected: string[];
|
|
13
|
+
ehlo: string[];
|
|
14
|
+
envelopeTime: number;
|
|
15
|
+
messageTime: number;
|
|
16
|
+
messageSize: number;
|
|
17
|
+
response: string;
|
|
18
|
+
envelope: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
to: string[];
|
|
21
|
+
from: string;
|
|
22
|
+
};
|
|
23
|
+
messageId: string;
|
|
24
|
+
}
|
|
6
25
|
interface SendMailOptions extends SendMailOptions$1 {
|
|
7
26
|
viewPath?: string;
|
|
8
27
|
viewData?: Record<string, any>;
|
|
9
28
|
}
|
|
10
29
|
interface SMTPConfig extends SMTPConnection.Options {
|
|
11
|
-
|
|
12
|
-
|
|
30
|
+
/** the hostname or IP address to connect to (defaults to ‘localhost’) */
|
|
31
|
+
host?: string | undefined;
|
|
32
|
+
/** the port to connect to (defaults to 25 or 465) */
|
|
33
|
+
port?: number | undefined;
|
|
34
|
+
/** defines authentication data */
|
|
13
35
|
auth: {
|
|
14
36
|
user: string;
|
|
15
37
|
pass: string;
|
|
16
38
|
};
|
|
17
39
|
}
|
|
40
|
+
interface SESConfig extends SESConnection__default.Options {
|
|
41
|
+
/** is an option that expects an instantiated aws.SES object */
|
|
42
|
+
SES: any;
|
|
43
|
+
/** How many messages per second is allowed to be delivered to SES */
|
|
44
|
+
maxConnections?: number | undefined;
|
|
45
|
+
/** How many parallel connections to allow towards SES */
|
|
46
|
+
sendingRate?: number | undefined;
|
|
47
|
+
}
|
|
48
|
+
interface SendMailConfig extends SendmailTransport__default.Options {
|
|
49
|
+
/** path to the sendmail command (defaults to ‘sendmail’) */
|
|
50
|
+
path?: string | undefined;
|
|
51
|
+
}
|
|
18
52
|
interface MailDriverContract {
|
|
19
|
-
send(options: SendMailOptions$1): Promise<
|
|
53
|
+
send(options: SendMailOptions$1): Promise<DeliveryReport | SentMessageInfo | undefined | void>;
|
|
20
54
|
}
|
|
21
55
|
|
|
22
56
|
declare abstract class Mailable {
|
|
@@ -51,7 +85,32 @@ declare class Mailer {
|
|
|
51
85
|
private driver;
|
|
52
86
|
private edgeRenderer;
|
|
53
87
|
constructor(driver: MailDriverContract, edgeRenderer: (viewPath: string, data: Record<string, any>) => Promise<string>);
|
|
54
|
-
send(mailable: Mailable): Promise<
|
|
88
|
+
send(mailable: Mailable): Promise<DeliveryReport | undefined | void>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Service class to initialize and configure the mailer service
|
|
93
|
+
*/
|
|
94
|
+
declare class Service {
|
|
95
|
+
/**
|
|
96
|
+
* Initializes the mailer service with the given application instance
|
|
97
|
+
*
|
|
98
|
+
* @param app
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
static init(app: Application): Mailer;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare class LOGDriver implements MailDriverContract {
|
|
105
|
+
private transporter;
|
|
106
|
+
constructor(_config: any);
|
|
107
|
+
send(options: SendMailOptions$1): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare class SESDriver implements MailDriverContract {
|
|
111
|
+
private transporter;
|
|
112
|
+
constructor(config: SESConfig);
|
|
113
|
+
send(options: SendMailOptions$1): Promise<SESConnection.SentMessageInfo>;
|
|
55
114
|
}
|
|
56
115
|
|
|
57
116
|
declare class SMTPDriver implements MailDriverContract {
|
|
@@ -60,6 +119,12 @@ declare class SMTPDriver implements MailDriverContract {
|
|
|
60
119
|
send(options: SendMailOptions$1): Promise<nodemailer_lib_smtp_transport.SentMessageInfo>;
|
|
61
120
|
}
|
|
62
121
|
|
|
122
|
+
declare class SendMailDriver implements MailDriverContract {
|
|
123
|
+
private transporter;
|
|
124
|
+
constructor(config: SendMailConfig);
|
|
125
|
+
send(options: SendMailOptions$1): Promise<SendmailTransport.SentMessageInfo>;
|
|
126
|
+
}
|
|
127
|
+
|
|
63
128
|
/**
|
|
64
129
|
* Mail delivery setup.
|
|
65
130
|
*
|
|
@@ -74,4 +139,4 @@ declare class MailServiceProvider extends ServiceProvider {
|
|
|
74
139
|
boot(): void;
|
|
75
140
|
}
|
|
76
141
|
|
|
77
|
-
export { type MailDriverContract, MailServiceProvider, Mailable, Mailer, type SMTPConfig, SMTPDriver, type SendMailOptions };
|
|
142
|
+
export { type DeliveryReport, LOGDriver, type MailDriverContract, MailServiceProvider, Mailable, Mailer, type SESConfig, SESDriver, type SMTPConfig, SMTPDriver, type SendMailConfig, SendMailDriver, type SendMailOptions, Service };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,56 @@
|
|
|
1
|
-
import { SendMailOptions as SendMailOptions$1 } from 'nodemailer';
|
|
1
|
+
import { SendMailOptions as SendMailOptions$1, SentMessageInfo } from 'nodemailer';
|
|
2
|
+
import * as SESConnection from 'nodemailer/lib/ses-transport';
|
|
3
|
+
import SESConnection__default from 'nodemailer/lib/ses-transport';
|
|
2
4
|
import SMTPConnection from 'nodemailer/lib/smtp-connection';
|
|
5
|
+
import * as SendmailTransport from 'nodemailer/lib/sendmail-transport';
|
|
6
|
+
import SendmailTransport__default from 'nodemailer/lib/sendmail-transport';
|
|
7
|
+
import { Application, ServiceProvider } from '@h3ravel/core';
|
|
3
8
|
import * as nodemailer_lib_smtp_transport from 'nodemailer/lib/smtp-transport';
|
|
4
|
-
import { ServiceProvider } from '@h3ravel/core';
|
|
5
9
|
|
|
10
|
+
interface DeliveryReport {
|
|
11
|
+
accepted: string[];
|
|
12
|
+
rejected: string[];
|
|
13
|
+
ehlo: string[];
|
|
14
|
+
envelopeTime: number;
|
|
15
|
+
messageTime: number;
|
|
16
|
+
messageSize: number;
|
|
17
|
+
response: string;
|
|
18
|
+
envelope: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
to: string[];
|
|
21
|
+
from: string;
|
|
22
|
+
};
|
|
23
|
+
messageId: string;
|
|
24
|
+
}
|
|
6
25
|
interface SendMailOptions extends SendMailOptions$1 {
|
|
7
26
|
viewPath?: string;
|
|
8
27
|
viewData?: Record<string, any>;
|
|
9
28
|
}
|
|
10
29
|
interface SMTPConfig extends SMTPConnection.Options {
|
|
11
|
-
|
|
12
|
-
|
|
30
|
+
/** the hostname or IP address to connect to (defaults to ‘localhost’) */
|
|
31
|
+
host?: string | undefined;
|
|
32
|
+
/** the port to connect to (defaults to 25 or 465) */
|
|
33
|
+
port?: number | undefined;
|
|
34
|
+
/** defines authentication data */
|
|
13
35
|
auth: {
|
|
14
36
|
user: string;
|
|
15
37
|
pass: string;
|
|
16
38
|
};
|
|
17
39
|
}
|
|
40
|
+
interface SESConfig extends SESConnection__default.Options {
|
|
41
|
+
/** is an option that expects an instantiated aws.SES object */
|
|
42
|
+
SES: any;
|
|
43
|
+
/** How many messages per second is allowed to be delivered to SES */
|
|
44
|
+
maxConnections?: number | undefined;
|
|
45
|
+
/** How many parallel connections to allow towards SES */
|
|
46
|
+
sendingRate?: number | undefined;
|
|
47
|
+
}
|
|
48
|
+
interface SendMailConfig extends SendmailTransport__default.Options {
|
|
49
|
+
/** path to the sendmail command (defaults to ‘sendmail’) */
|
|
50
|
+
path?: string | undefined;
|
|
51
|
+
}
|
|
18
52
|
interface MailDriverContract {
|
|
19
|
-
send(options: SendMailOptions$1): Promise<
|
|
53
|
+
send(options: SendMailOptions$1): Promise<DeliveryReport | SentMessageInfo | undefined | void>;
|
|
20
54
|
}
|
|
21
55
|
|
|
22
56
|
declare abstract class Mailable {
|
|
@@ -51,7 +85,32 @@ declare class Mailer {
|
|
|
51
85
|
private driver;
|
|
52
86
|
private edgeRenderer;
|
|
53
87
|
constructor(driver: MailDriverContract, edgeRenderer: (viewPath: string, data: Record<string, any>) => Promise<string>);
|
|
54
|
-
send(mailable: Mailable): Promise<
|
|
88
|
+
send(mailable: Mailable): Promise<DeliveryReport | undefined | void>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Service class to initialize and configure the mailer service
|
|
93
|
+
*/
|
|
94
|
+
declare class Service {
|
|
95
|
+
/**
|
|
96
|
+
* Initializes the mailer service with the given application instance
|
|
97
|
+
*
|
|
98
|
+
* @param app
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
static init(app: Application): Mailer;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare class LOGDriver implements MailDriverContract {
|
|
105
|
+
private transporter;
|
|
106
|
+
constructor(_config: any);
|
|
107
|
+
send(options: SendMailOptions$1): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare class SESDriver implements MailDriverContract {
|
|
111
|
+
private transporter;
|
|
112
|
+
constructor(config: SESConfig);
|
|
113
|
+
send(options: SendMailOptions$1): Promise<SESConnection.SentMessageInfo>;
|
|
55
114
|
}
|
|
56
115
|
|
|
57
116
|
declare class SMTPDriver implements MailDriverContract {
|
|
@@ -60,6 +119,12 @@ declare class SMTPDriver implements MailDriverContract {
|
|
|
60
119
|
send(options: SendMailOptions$1): Promise<nodemailer_lib_smtp_transport.SentMessageInfo>;
|
|
61
120
|
}
|
|
62
121
|
|
|
122
|
+
declare class SendMailDriver implements MailDriverContract {
|
|
123
|
+
private transporter;
|
|
124
|
+
constructor(config: SendMailConfig);
|
|
125
|
+
send(options: SendMailOptions$1): Promise<SendmailTransport.SentMessageInfo>;
|
|
126
|
+
}
|
|
127
|
+
|
|
63
128
|
/**
|
|
64
129
|
* Mail delivery setup.
|
|
65
130
|
*
|
|
@@ -74,4 +139,4 @@ declare class MailServiceProvider extends ServiceProvider {
|
|
|
74
139
|
boot(): void;
|
|
75
140
|
}
|
|
76
141
|
|
|
77
|
-
export { type MailDriverContract, MailServiceProvider, Mailable, Mailer, type SMTPConfig, SMTPDriver, type SendMailOptions };
|
|
142
|
+
export { type DeliveryReport, LOGDriver, type MailDriverContract, MailServiceProvider, Mailable, Mailer, type SESConfig, SESDriver, type SMTPConfig, SMTPDriver, type SendMailConfig, SendMailDriver, type SendMailOptions, Service };
|
package/dist/index.js
CHANGED
|
@@ -88,19 +88,50 @@ var Mailer = class {
|
|
|
88
88
|
if (options.viewPath && !options.html) {
|
|
89
89
|
options.html = await this.edgeRenderer(options.viewPath, options.viewData || {});
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
try {
|
|
92
|
+
return this.driver.send(options);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
92
96
|
}
|
|
93
97
|
};
|
|
94
98
|
|
|
95
|
-
// src/Drivers/
|
|
99
|
+
// src/Drivers/SESDriver.ts
|
|
96
100
|
import nodemailer from "nodemailer";
|
|
101
|
+
var SESDriver = class {
|
|
102
|
+
static {
|
|
103
|
+
__name(this, "SESDriver");
|
|
104
|
+
}
|
|
105
|
+
transporter;
|
|
106
|
+
constructor(config) {
|
|
107
|
+
this.transporter = nodemailer.createTransport({
|
|
108
|
+
SES: config.SES,
|
|
109
|
+
maxConnections: config.maxConnections,
|
|
110
|
+
sendingRate: config.sendingRate
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async send(options) {
|
|
114
|
+
return await this.transporter.sendMail({
|
|
115
|
+
to: options.to,
|
|
116
|
+
cc: options.cc,
|
|
117
|
+
bcc: options.bcc,
|
|
118
|
+
subject: options.subject,
|
|
119
|
+
html: options.html,
|
|
120
|
+
text: options.text,
|
|
121
|
+
attachments: options.attachments
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/Drivers/SMTPDriver.ts
|
|
127
|
+
import nodemailer2 from "nodemailer";
|
|
97
128
|
var SMTPDriver = class {
|
|
98
129
|
static {
|
|
99
130
|
__name(this, "SMTPDriver");
|
|
100
131
|
}
|
|
101
132
|
transporter;
|
|
102
133
|
constructor(config) {
|
|
103
|
-
this.transporter =
|
|
134
|
+
this.transporter = nodemailer2.createTransport({
|
|
104
135
|
host: config.host,
|
|
105
136
|
port: config.port,
|
|
106
137
|
secure: config.port === 465,
|
|
@@ -123,38 +154,150 @@ var SMTPDriver = class {
|
|
|
123
154
|
}
|
|
124
155
|
};
|
|
125
156
|
|
|
126
|
-
// src/
|
|
127
|
-
import
|
|
128
|
-
|
|
157
|
+
// src/Drivers/LOGDriver.ts
|
|
158
|
+
import nodemailer3 from "nodemailer";
|
|
159
|
+
import Stream from "stream";
|
|
160
|
+
var LOGDriver = class {
|
|
129
161
|
static {
|
|
130
|
-
__name(this, "
|
|
162
|
+
__name(this, "LOGDriver");
|
|
131
163
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
164
|
+
transporter;
|
|
165
|
+
constructor(_config) {
|
|
166
|
+
this.transporter = nodemailer3.createTransport({
|
|
167
|
+
streamTransport: true,
|
|
168
|
+
newline: "unix"
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
async send(options) {
|
|
172
|
+
this.transporter.sendMail(options, (err, info) => {
|
|
173
|
+
if (err)
|
|
174
|
+
throw err;
|
|
175
|
+
console.log(info.envelope);
|
|
176
|
+
console.log(info.messageId);
|
|
177
|
+
info.message instanceof Stream.Readable && info.message.pipe(process.stdout);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/Drivers/SendMailDriver.ts
|
|
183
|
+
import nodemailer4 from "nodemailer";
|
|
184
|
+
var SendMailDriver = class {
|
|
185
|
+
static {
|
|
186
|
+
__name(this, "SendMailDriver");
|
|
187
|
+
}
|
|
188
|
+
transporter;
|
|
189
|
+
constructor(config) {
|
|
190
|
+
this.transporter = nodemailer4.createTransport({
|
|
191
|
+
sendmail: true,
|
|
192
|
+
path: config.path
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
async send(options) {
|
|
196
|
+
return await this.transporter.sendMail({
|
|
197
|
+
to: options.to,
|
|
198
|
+
cc: options.cc,
|
|
199
|
+
bcc: options.bcc,
|
|
200
|
+
subject: options.subject,
|
|
201
|
+
html: options.html,
|
|
202
|
+
text: options.text,
|
|
203
|
+
attachments: options.attachments
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// src/Service.ts
|
|
209
|
+
var Service = class {
|
|
210
|
+
static {
|
|
211
|
+
__name(this, "Service");
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Initializes the mailer service with the given application instance
|
|
215
|
+
*
|
|
216
|
+
* @param app
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
219
|
+
static init(app) {
|
|
220
|
+
const view = app.make("view");
|
|
221
|
+
const config = app.make("config");
|
|
222
|
+
const mailConfig = {
|
|
223
|
+
/**
|
|
224
|
+
* SMTP configuration with fallback defaults
|
|
225
|
+
*/
|
|
226
|
+
smtp: {
|
|
138
227
|
host: config.get("mail.mailers.smtp.host", "smtp.mailtrap.io"),
|
|
139
228
|
port: Number(config.get("mail.mailers.smtp.port", 2525)),
|
|
140
229
|
auth: {
|
|
141
230
|
user: config.get("mail.mailers.smtp.username", ""),
|
|
142
231
|
pass: config.get("mail.mailers.smtp.password", "")
|
|
143
232
|
},
|
|
144
|
-
opportunisticTLS: config.get("mail.
|
|
233
|
+
opportunisticTLS: config.get("mail.mail\u6C14\u7684mailers.smtp.encryption") === "tls",
|
|
145
234
|
connectionTimeout: config.get("mail.mailers.smtp.timeout"),
|
|
146
235
|
debug: false
|
|
147
|
-
}
|
|
148
|
-
|
|
236
|
+
},
|
|
237
|
+
/**
|
|
238
|
+
* SES configuration with fallback defaults
|
|
239
|
+
*/
|
|
240
|
+
ses: {
|
|
241
|
+
SES: config.get("mail.mailers.ses.transport", "ses"),
|
|
242
|
+
maxConnections: config.get("mail.mailers.ses.connections", 10),
|
|
243
|
+
sendingRate: config.get("mail.mailers.ses.rate", 5)
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* Sendmail configuration with fallback default path
|
|
247
|
+
*/
|
|
248
|
+
sendmail: {
|
|
249
|
+
path: config.get("mail.mailers.sendmail.path", "sendmail")
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const driver = {
|
|
253
|
+
/**
|
|
254
|
+
* SES driver factory
|
|
255
|
+
* @returns
|
|
256
|
+
*/
|
|
257
|
+
ses: () => new SESDriver(mailConfig.ses),
|
|
258
|
+
/**
|
|
259
|
+
* SMTP driver factory
|
|
260
|
+
* @returns
|
|
261
|
+
*/
|
|
262
|
+
smtp: () => new SMTPDriver(mailConfig.smtp),
|
|
263
|
+
/**
|
|
264
|
+
* LOG driver factory for debugging
|
|
265
|
+
* @returns
|
|
266
|
+
*/
|
|
267
|
+
log: () => new LOGDriver(mailConfig.smtp),
|
|
268
|
+
/**
|
|
269
|
+
* Sendmail driver factory
|
|
270
|
+
* @returns
|
|
271
|
+
*/
|
|
272
|
+
sendmail: () => new SendMailDriver(mailConfig.sendmail)
|
|
273
|
+
};
|
|
274
|
+
return new Mailer((driver[config.get("mail.default")] ?? driver.smtp)(), async (viewPath, data) => await view(viewPath, data));
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// src/Providers/MailServiceProvider.ts
|
|
279
|
+
import { ServiceProvider } from "@h3ravel/core";
|
|
280
|
+
var MailServiceProvider = class extends ServiceProvider {
|
|
281
|
+
static {
|
|
282
|
+
__name(this, "MailServiceProvider");
|
|
283
|
+
}
|
|
284
|
+
static priority = 990;
|
|
285
|
+
register() {
|
|
286
|
+
this.app.singleton(Mailer, () => {
|
|
287
|
+
return Service.init(this.app);
|
|
149
288
|
});
|
|
150
289
|
}
|
|
151
290
|
boot() {
|
|
152
291
|
}
|
|
153
292
|
};
|
|
154
293
|
export {
|
|
294
|
+
LOGDriver,
|
|
155
295
|
MailServiceProvider,
|
|
156
296
|
Mailable,
|
|
157
297
|
Mailer,
|
|
158
|
-
|
|
298
|
+
SESDriver,
|
|
299
|
+
SMTPDriver,
|
|
300
|
+
SendMailDriver,
|
|
301
|
+
Service
|
|
159
302
|
};
|
|
160
303
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Mailable.ts","../src/Mailer.ts","../src/Drivers/SMTPDriver.ts","../src/Providers/MailServiceProvider.ts"],"sourcesContent":["import type { SendMailOptions } from \"./Contracts/Mailer\";\n\nexport abstract class Mailable {\n protected toAddress?: string;\n protected ccAddresses?: string[];\n protected bccAddresses?: string[];\n protected subjectText?: string;\n protected htmlContent?: string;\n protected textContent?: string;\n protected viewPath?: string;\n protected viewData?: Record<string, any>;\n protected attachmentsList?: SendMailOptions['attachments'];\n\n to (address: string) {\n this.toAddress = address;\n return this;\n }\n\n cc (...addresses: string[]) {\n this.ccAddresses = addresses;\n return this;\n }\n\n bcc (...addresses: string[]) {\n this.bccAddresses = addresses;\n return this;\n }\n\n subject (subject: string) {\n this.subjectText = subject;\n return this;\n }\n\n html (html: string) {\n this.htmlContent = html;\n return this;\n }\n\n text (text: string) {\n this.textContent = text;\n return this;\n }\n\n view (path: string, data: Record<string, any> = {}) {\n this.viewPath = path;\n this.viewData = data;\n return this;\n }\n\n attach (filename: string, filePath: string) {\n if (!this.attachmentsList) this.attachmentsList = [];\n this.attachmentsList.push({ filename, path: filePath });\n return this;\n }\n\n /**\n * Child classes should define build() like in Laravel\n */\n abstract build (): Promise<this> | this;\n\n /**\n * Called internally by Mailer\n */\n getMessageOptions (): SendMailOptions {\n return {\n to: this.toAddress,\n cc: this.ccAddresses,\n bcc: this.bccAddresses,\n subject: this.subjectText,\n html: this.htmlContent,\n text: this.textContent,\n viewPath: this.viewPath,\n viewData: this.viewData,\n attachments: this.attachmentsList\n };\n }\n}\n","import { MailDriverContract } from './Contracts/Mailer';\nimport { Mailable } from './Mailable';\n\nexport class Mailer {\n constructor(\n private driver: MailDriverContract,\n private edgeRenderer: (viewPath: string, data: Record<string, any>) => Promise<string>\n ) { }\n\n async send (mailable: Mailable) {\n await mailable.build();\n\n const options = mailable.getMessageOptions();\n\n if (options.viewPath && !options.html) {\n options.html = await this.edgeRenderer(options.viewPath, options.viewData || {});\n }\n\n return this.driver.send(options);\n }\n}\n","import nodemailer, { type SendMailOptions, type TransportOptions } from 'nodemailer';\n\nimport { MailDriverContract, SMTPConfig } from '../Contracts/Mailer';\n\nexport class SMTPDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SMTPConfig) {\n this.transporter = nodemailer.createTransport({\n host: config.host,\n port: config.port,\n secure: config.port === 465, // auto decide based on port\n auth: {\n user: config.auth.user,\n pass: config.auth.pass\n }\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import { Mailer } from '../Mailer';\nimport { SMTPConfig } from '../Contracts/Mailer';\nimport { SMTPDriver } from '../Drivers/SMTPDriver';\nimport { ServiceProvider } from '@h3ravel/core';\n\n/**\n * Mail delivery setup.\n * \n * Bind Mailer service.\n * Load mail drivers (SMTP, SES, etc.).\n * Register Mail facade.\n * \n */\nexport class MailServiceProvider extends ServiceProvider {\n public static priority = 990;\n register () {\n /**\n * Register Mailer instance\n */\n\n this.app.singleton<any>('mailer', () => {\n // this.app.bind(Mailer, () => {\n const view = this.app.make('view');\n const config = this.app.make('config');\n\n const smtpConfig: SMTPConfig = {\n host: config.get('mail.mailers.smtp.host', 'smtp.mailtrap.io'),\n port: Number(config.get('mail.mailers.smtp.port', 2525)),\n auth: {\n user: config.get('mail.mailers.smtp.username', ''),\n pass: config.get('mail.mailers.smtp.password', ''),\n },\n opportunisticTLS: config.get('mail.mailers.smtp.encryption') === 'tls',\n connectionTimeout: config.get('mail.mailers.smtp.timeout'),\n debug: false,\n };\n\n return new Mailer(\n new SMTPDriver(smtpConfig),\n async (viewPath, data) => await view(viewPath, data)\n );\n });\n }\n\n boot () {\n /**\n * Add logic here for global mail \"from\" address and others\n */\n }\n}\n"],"mappings":";;;;AAEO,IAAeA,WAAf,MAAeA;EAAtB,OAAsBA;;;EACRC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EAEVC,GAAIC,SAAiB;AACjB,SAAKV,YAAYU;AACjB,WAAO;EACX;EAEAC,MAAOC,WAAqB;AACxB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,OAAQD,WAAqB;AACzB,SAAKV,eAAeU;AACpB,WAAO;EACX;EAEAE,QAASA,SAAiB;AACtB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMA,MAAc;AAChB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMA,MAAc;AAChB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMC,MAAcC,OAA4B,CAAC,GAAG;AAChD,SAAKb,WAAWY;AAChB,SAAKX,WAAWY;AAChB,WAAO;EACX;EAEAC,OAAQC,UAAkBC,UAAkB;AACxC,QAAI,CAAC,KAAKd;AAAiB,WAAKA,kBAAkB,CAAA;AAClD,SAAKA,gBAAgBe,KAAK;MAAEF;MAAUH,MAAMI;IAAS,CAAA;AACrD,WAAO;EACX;;;;EAUAE,oBAAsC;AAClC,WAAO;MACHf,IAAI,KAAKT;MACTW,IAAI,KAAKV;MACTY,KAAK,KAAKX;MACVY,SAAS,KAAKX;MACdY,MAAM,KAAKX;MACXY,MAAM,KAAKX;MACXC,UAAU,KAAKA;MACfC,UAAU,KAAKA;MACfkB,aAAa,KAAKjB;IACtB;EACJ;AACJ;;;ACzEO,IAAMkB,SAAN,MAAMA;EAAb,OAAaA;;;;;EACT,YACY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AAM;UACFC,MAAMP,OAAOG,IAAI,8BAA8B,EAAA;UAC/CK,MAAMR,OAAOG,IAAI,8BAA8B,EAAA;QACnD;QACAM,kBAAkBT,OAAOG,IAAI,8BAAA,MAAoC;QACjEO,mBAAmBV,OAAOG,IAAI,2BAAA;QAC9BQ,OAAO;MACX;AAEA,aAAO,IAAIC,OACP,IAAIC,WAAWZ,UAAAA,GACf,OAAOa,UAAUC,SAAS,MAAMjB,KAAKgB,UAAUC,IAAAA,CAAAA;IAEvD,CAAA;EACJ;EAEAC,OAAQ;EAIR;AACJ;","names":["Mailable","toAddress","ccAddresses","bccAddresses","subjectText","htmlContent","textContent","viewPath","viewData","attachmentsList","to","address","cc","addresses","bcc","subject","html","text","view","path","data","attach","filename","filePath","push","getMessageOptions","attachments","Mailer","driver","edgeRenderer","send","mailable","build","options","getMessageOptions","viewPath","html","viewData","nodemailer","SMTPDriver","transporter","config","nodemailer","createTransport","host","port","secure","auth","user","pass","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","ServiceProvider","MailServiceProvider","ServiceProvider","priority","register","app","singleton","view","make","config","smtpConfig","host","get","port","Number","auth","user","pass","opportunisticTLS","connectionTimeout","debug","Mailer","SMTPDriver","viewPath","data","boot"]}
|
|
1
|
+
{"version":3,"sources":["../src/Mailable.ts","../src/Mailer.ts","../src/Drivers/SESDriver.ts","../src/Drivers/SMTPDriver.ts","../src/Drivers/LOGDriver.ts","../src/Drivers/SendMailDriver.ts","../src/Service.ts","../src/Providers/MailServiceProvider.ts"],"sourcesContent":["import type { SendMailOptions } from \"./Contracts/Mailer\";\n\nexport abstract class Mailable {\n protected toAddress?: string;\n protected ccAddresses?: string[];\n protected bccAddresses?: string[];\n protected subjectText?: string;\n protected htmlContent?: string;\n protected textContent?: string;\n protected viewPath?: string;\n protected viewData?: Record<string, any>;\n protected attachmentsList?: SendMailOptions['attachments'];\n\n to (address: string) {\n this.toAddress = address;\n return this;\n }\n\n cc (...addresses: string[]) {\n this.ccAddresses = addresses;\n return this;\n }\n\n bcc (...addresses: string[]) {\n this.bccAddresses = addresses;\n return this;\n }\n\n subject (subject: string) {\n this.subjectText = subject;\n return this;\n }\n\n html (html: string) {\n this.htmlContent = html;\n return this;\n }\n\n text (text: string) {\n this.textContent = text;\n return this;\n }\n\n view (path: string, data: Record<string, any> = {}) {\n this.viewPath = path;\n this.viewData = data;\n return this;\n }\n\n attach (filename: string, filePath: string) {\n if (!this.attachmentsList) this.attachmentsList = [];\n this.attachmentsList.push({ filename, path: filePath });\n return this;\n }\n\n /**\n * Child classes should define build() like in Laravel\n */\n abstract build (): Promise<this> | this;\n\n /**\n * Called internally by Mailer\n */\n getMessageOptions (): SendMailOptions {\n return {\n to: this.toAddress,\n cc: this.ccAddresses,\n bcc: this.bccAddresses,\n subject: this.subjectText,\n html: this.htmlContent,\n text: this.textContent,\n viewPath: this.viewPath,\n viewData: this.viewData,\n attachments: this.attachmentsList\n };\n }\n}\n","import { DeliveryReport, MailDriverContract } from './Contracts/Mailer';\n\nimport { Mailable } from './Mailable';\n\nexport class Mailer {\n constructor(\n private driver: MailDriverContract,\n private edgeRenderer: (viewPath: string, data: Record<string, any>) => Promise<string>\n ) { }\n\n async send (mailable: Mailable): Promise<DeliveryReport | undefined | void> {\n await mailable.build();\n\n const options = mailable.getMessageOptions();\n\n if (options.viewPath && !options.html) {\n options.html = await this.edgeRenderer(options.viewPath, options.viewData || {});\n }\n\n try {\n return this.driver.send(options);\n } catch (error) {\n return\n }\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract, SESConfig } from '../Contracts/Mailer';\n\nexport class SESDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SESConfig) {\n this.transporter = nodemailer.createTransport({\n SES: config.SES,\n maxConnections: config.maxConnections,\n sendingRate: config.sendingRate\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract, SMTPConfig } from '../Contracts/Mailer';\n\nexport class SMTPDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SMTPConfig) {\n this.transporter = nodemailer.createTransport({\n host: config.host,\n port: config.port,\n secure: config.port === 465, // auto decide based on port\n auth: {\n user: config.auth.user,\n pass: config.auth.pass\n }\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract } from '../Contracts/Mailer';\nimport Stream from 'stream';\n\nexport class LOGDriver implements MailDriverContract {\n private transporter\n\n constructor(_config: any) {\n this.transporter = nodemailer.createTransport({\n streamTransport: true,\n newline: \"unix\",\n });\n }\n\n async send (options: SendMailOptions) {\n this.transporter.sendMail(options, (err, info) => {\n if (err) throw err;\n console.log(info.envelope);\n console.log(info.messageId);\n // Pipe the raw RFC 822 message to STDOUT\n info.message instanceof Stream.Readable && info.message.pipe(process.stdout);\n }\n );\n }\n}\n","import nodemailer, { type SendMailOptions } from 'nodemailer';\n\nimport { MailDriverContract, SendMailConfig } from '../Contracts/Mailer';\n\nexport class SendMailDriver implements MailDriverContract {\n private transporter;\n\n constructor(config: SendMailConfig) {\n this.transporter = nodemailer.createTransport({\n sendmail: true,\n path: config.path,\n });\n }\n\n async send (options: SendMailOptions) {\n return await this.transporter.sendMail({\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n subject: options.subject,\n html: options.html,\n text: options.text,\n attachments: options.attachments\n });\n }\n}\n","import { Application } from \"@h3ravel/core\";\nimport { SendMailConfig, SESConfig, SMTPConfig } from \"./Contracts/Mailer\";\nimport { SESDriver } from \"./Drivers/SESDriver\";\nimport { SMTPDriver } from \"./Drivers/SMTPDriver\";\nimport { LOGDriver } from \"./Drivers/LOGDriver\";\nimport { SendMailDriver } from \"./Drivers/SendMailDriver\";\nimport { Mailer } from \"./Mailer\";\n\n/**\n * Service class to initialize and configure the mailer service\n */\nexport class Service {\n /**\n * Initializes the mailer service with the given application instance\n * \n * @param app \n * @returns \n */\n static init (app: Application) {\n /**\n * Resolve the view and config services from the container\n */\n const view = app.make('view');\n const config = app.make('config');\n\n /**\n * Configure mailer settings for different drivers\n */\n const mailConfig = {\n /**\n * SMTP configuration with fallback defaults\n */\n smtp: <SMTPConfig>{\n host: config.get('mail.mailers.smtp.host', 'smtp.mailtrap.io'),\n port: Number(config.get('mail.mailers.smtp.port', 2525)),\n auth: {\n user: config.get('mail.mailers.smtp.username', ''),\n pass: config.get('mail.mailers.smtp.password', ''),\n },\n opportunisticTLS: config.get('mail.mail气的mailers.smtp.encryption') === 'tls',\n connectionTimeout: config.get('mail.mailers.smtp.timeout'),\n debug: false,\n },\n /**\n * SES configuration with fallback defaults\n */\n ses: <SESConfig>{\n SES: config.get('mail.mailers.ses.transport', 'ses'),\n maxConnections: config.get('mail.mailers.ses.connections', 10),\n sendingRate: config.get('mail.mailers.ses.rate', 5),\n },\n /**\n * Sendmail configuration with fallback default path\n */\n sendmail: <SendMailConfig>{\n path: config.get('mail.mailers.sendmail.path', 'sendmail'),\n },\n };\n\n /**\n * Define available mail drivers\n */\n const driver = {\n /**\n * SES driver factory\n * @returns \n */\n ses: () => new SESDriver(mailConfig.ses),\n /**\n * SMTP driver factory\n * @returns \n */\n smtp: () => new SMTPDriver(mailConfig.smtp),\n /**\n * LOG driver factory for debugging\n * @returns \n */\n log: () => new LOGDriver(mailConfig.smtp),\n /**\n * Sendmail driver factory\n * @returns \n */\n sendmail: () => new SendMailDriver(mailConfig.sendmail),\n };\n\n /**\n * Initialize Mailer with the selected driver (default to SMTP if not specified)\n * and a view rendering function\n */\n return new Mailer(\n (driver[config.get('mail.default') as keyof typeof driver] ?? driver.smtp)(),\n async (viewPath, data) => await view(viewPath, data)\n );\n }\n}\n","import { SESConfig, SMTPConfig, SendMailConfig } from '../Contracts/Mailer';\n\nimport { LOGDriver } from '../Drivers/LOGDriver';\nimport { Mailer } from '../Mailer';\nimport { SESDriver } from '../Drivers/SESDriver';\nimport { SMTPDriver } from '../Drivers/SMTPDriver';\nimport { SendMailDriver } from '../Drivers/SendMailDriver';\nimport { Service } from '../Service';\nimport { ServiceProvider } from '@h3ravel/core';\n\n/**\n * Mail delivery setup.\n * \n * Bind Mailer service.\n * Load mail drivers (SMTP, SES, etc.).\n * Register Mail facade.\n * \n */\nexport class MailServiceProvider extends ServiceProvider {\n public static priority = 990;\n register () {\n /**\n * Register Mailer instance\n */\n this.app.singleton<any>(Mailer, () => {\n return Service.init(this.app)\n });\n }\n\n boot () {\n /**\n * Add logic here for global mail \"from\" address and others\n */\n }\n}\n"],"mappings":";;;;AAEO,IAAeA,WAAf,MAAeA;EAAtB,OAAsBA;;;EACRC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EAEVC,GAAIC,SAAiB;AACjB,SAAKV,YAAYU;AACjB,WAAO;EACX;EAEAC,MAAOC,WAAqB;AACxB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,OAAQD,WAAqB;AACzB,SAAKV,eAAeU;AACpB,WAAO;EACX;EAEAE,QAASA,SAAiB;AACtB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMA,MAAc;AAChB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMA,MAAc;AAChB,SAAKX,cAAcW;AACnB,WAAO;EACX;EAEAC,KAAMC,MAAcC,OAA4B,CAAC,GAAG;AAChD,SAAKb,WAAWY;AAChB,SAAKX,WAAWY;AAChB,WAAO;EACX;EAEAC,OAAQC,UAAkBC,UAAkB;AACxC,QAAI,CAAC,KAAKd;AAAiB,WAAKA,kBAAkB,CAAA;AAClD,SAAKA,gBAAgBe,KAAK;MAAEF;MAAUH,MAAMI;IAAS,C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ASC,uBAAuB;AAUzB,IAAMC,sBAAN,cAAkCC,gBAAAA;EAfzC,OAeyCA;;;EACrC,OAAcC,WAAW;EACzBC,WAAY;AAIR,SAAKC,IAAIC,UAAeC,QAAQ,MAAA;AAC5B,aAAOC,QAAQC,KAAK,KAAKJ,GAAG;IAChC,CAAA;EACJ;EAEAK,OAAQ;EAIR;AACJ;","names":["Mailable","toAddress","ccAddresses","bccAddresses","subjectText","htmlContent","textContent","viewPath","viewData","attachmentsList","to","address","cc","addresses","bcc","subject","html","text","view","path","data","attach","filename","filePath","push","getMessageOptions","attachments","Mailer","driver","edgeRenderer","send","mailable","build","options","getMessageOptions","viewPath","html","viewData","error","nodemailer","SESDriver","transporter","config","nodemailer","createTransport","SES","maxConnections","sendingRate","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","nodemailer","SMTPDriver","transporter","config","nodemailer","createTransport","host","port","secure","auth","user","pass","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","nodemailer","Stream","LOGDriver","transporter","_config","nodemailer","createTransport","streamTransport","newline","send","options","sendMail","err","info","console","log","envelope","messageId","message","Stream","Readable","pipe","process","stdout","nodemailer","SendMailDriver","transporter","config","nodemailer","createTransport","sendmail","path","send","options","sendMail","to","cc","bcc","subject","html","text","attachments","Service","init","app","view","make","config","mailConfig","smtp","host","get","port","Number","auth","user","pass","opportunisticTLS","connectionTimeout","debug","ses","SES","maxConnections","sendingRate","sendmail","path","driver","SESDriver","SMTPDriver","log","LOGDriver","SendMailDriver","Mailer","viewPath","data","ServiceProvider","MailServiceProvider","ServiceProvider","priority","register","app","singleton","Mailer","Service","init","boot"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/mail",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Mail drivers and templates system for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "packages/mail"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@h3ravel/core": "^1.
|
|
29
|
+
"@h3ravel/core": "^1.5.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/nodemailer": "^6.4.17",
|