Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
9e44474348 | |||
0c44743d99 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsmtp",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsmtp",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"private": false,
|
||||
"description": "a module for handling smtp stuff",
|
||||
"main": "dist_ts/index.js",
|
||||
|
12
ts/index.ts
12
ts/index.ts
@ -31,13 +31,23 @@ export class Smartsmtp {
|
||||
toArg: string,
|
||||
dataArg = {}
|
||||
) {
|
||||
const message = {
|
||||
const message: plugins.nodemailer.SendMailOptions = {
|
||||
from: smartmailArg.options.from,
|
||||
to: toArg,
|
||||
subject: smartmailArg.getSubject(dataArg),
|
||||
text: smartmailArg.getBody(dataArg),
|
||||
html: smartmailArg.getBody(dataArg),
|
||||
attachments: []
|
||||
};
|
||||
|
||||
// lets add attachments from smartmailArg
|
||||
for (const attachment of smartmailArg.attachments) {
|
||||
message.attachments.push({
|
||||
filename: attachment.parsedPath.base,
|
||||
content: attachment.contentBuffer
|
||||
});
|
||||
}
|
||||
|
||||
const response = await this.nodemailerTransport.sendMail(message);
|
||||
return response;
|
||||
}
|
||||
|
Reference in New Issue
Block a user