@vroskus/library-email 1.0.15 → 1.0.16
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.d.ts +1 -1
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type $Config = Config;
|
|
|
23
23
|
declare class EmailService<C extends Config> {
|
|
24
24
|
#private;
|
|
25
25
|
from: string;
|
|
26
|
-
transporter: $Transporter;
|
|
26
|
+
transporter: $Transporter | null;
|
|
27
27
|
constructor({ email, from, host, password, port, username, }: C);
|
|
28
28
|
sendMail({ bcc, content, replyTo, subject, to, }: {
|
|
29
29
|
bcc?: Array<string> | string;
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ class EmailService {
|
|
|
24
24
|
constructor({ email, from, host, password, port, username, }) {
|
|
25
25
|
_EmailService_instances.add(this);
|
|
26
26
|
this.from = `"${from}" <${email}>`;
|
|
27
|
+
this.transporter = null;
|
|
27
28
|
__classPrivateFieldGet(this, _EmailService_instances, "m", _EmailService_setupTransporter).call(this, {
|
|
28
29
|
host,
|
|
29
30
|
password,
|
|
@@ -42,9 +43,12 @@ class EmailService {
|
|
|
42
43
|
text: (0, html_to_text_1.htmlToText)(content),
|
|
43
44
|
to,
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (this.transporter !== null) {
|
|
47
|
+
const info = yield this.transporter.sendMail(params);
|
|
48
|
+
console.log('info', info);
|
|
49
|
+
return info.messageId;
|
|
50
|
+
}
|
|
51
|
+
throw new Error('Transporter not initialised');
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
54
|
}
|