Package Exports
- nuxt-mail
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nuxt-mail) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
nuxt-mail
Adds mail sending capability to a Nuxt app. Adds a server route, an injected variable, and uses nodemailer to send emails
Install
# NPM
$ npm install nuxt-mail
# Yarn
$ yarn add nuxt-mail
Usage
Add the module to your nuxt.config.js
. It is recommended to also install the @nuxtjs/axios
module (see below):
export default {
modules: [
'@nuxtjs/axios',
['nuxt-mail', {
smtp: {
host: "smtp.example.com",
port: 587,
},
},
],
// or use the top-level option:
mail: {
smtp: {
host: "smtp.example.com",
port: 587,
},
},
}
The smtp
options are required and directly passed to nodemailer. Refer to their documentation for available options.
The module adds a /mail/send
post route, which can be invoked via $axios
:
// Inside a component
this.$axios.$post('/mail/send', {
from: 'John Doe',
subject: 'Incredible',
text: 'This is an incredible test message',
to: 'johndoe@gmail.com',
})
The module also injects the $mail
variable, which makes it even easier:
// Inside a component
this.$mail.send({
from: 'John Doe',
subject: 'Incredible',
text: 'This is an incredible test message',
to: 'johndoe@gmail.com',
})
Note that the options are passed to nodemailer. Refer to the documentation for available config options.
License
Unless stated otherwise all works are:
Copyright © Sebastian Landwehr info@dword-design.de
and licensed under: