nuxt-mailer
Advanced tools
Comparing version 0.10.2 to 0.11.0
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.10.2" | ||
"version": "0.11.0" | ||
} |
@@ -12,2 +12,3 @@ import { Transporter } from 'nodemailer'; | ||
}; | ||
attachments?: []; | ||
}; | ||
@@ -23,2 +24,7 @@ interface MailInterface { | ||
html: string; | ||
attachments?: { | ||
filename: string; | ||
path: string; | ||
contentType: string; | ||
}[]; | ||
} | ||
@@ -35,3 +41,4 @@ export type SendMailProps = { | ||
customTransporter: (options: TransporterOptions) => Transporter<import("nodemailer/lib/smtp-transport").SentMessageInfo>; | ||
defaultTransporter: Transporter<import("nodemailer/lib/smtp-transport").SentMessageInfo>; | ||
}; | ||
export {}; |
{ | ||
"name": "nuxt-mailer", | ||
"version": "0.10.2", | ||
"version": "0.11.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -418,3 +418,36 @@ # Nuxt Mailer | ||
``` | ||
sending attachments Example: | ||
```ts | ||
import { EmailTemplate } from './types/emailTypes' | ||
import { useMailer } from '#mailer' | ||
import { resolvePath } from '@nuxt/kit' | ||
type SendMail = { template: EmailTemplate, to: string, fromEmail: string, fromName: string, subject: string } | ||
export async function sendEmail(request: SendMail) { | ||
const mailService = useMailer() | ||
const filePath = await resolvePath('playground/server/app/email/test.pdf') | ||
return await mailService.sendMail({ | ||
requestId: 'test-key', | ||
options: { | ||
fromEmail: request.fromEmail, | ||
fromName: request.fromName, | ||
to: request.to, | ||
subject: request.subject, | ||
text: request.template.text, | ||
html: request.template.html, | ||
attachments: [{ | ||
filename: 'file.pdf', | ||
path: filePath, | ||
contentType: 'application/pdf' | ||
}], | ||
} | ||
}) | ||
} | ||
``` | ||
## Development | ||
@@ -421,0 +454,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21216
189
458