strapi-provider-email-smtp2
v0.2.0
Published
Strapi SMTP email provider with nodemailer
Maintainers
Readme
strapi-provider-email-smtp2
A third-party SMTP email provider for Strapi.
Installation
In the root directory of your project, run:
npm i strapi-provider-email-smtp2Configuration
In your config/plugins.js, set the following:
module.exports = ({ env }) => ({
email: {
provider: 'smtp2',
providerOptions: {
host: 'smtp.gmail.com', //SMTP Host
port: 465 , //SMTP Port
secure: true,
username: '[email protected]',
password: 'my.password',
rejectUnauthorized: true,
requireTLS: true,
connectionTimeout: 1,
},
settings: {
from: '[email protected]',
replyTo: '[email protected]',
},
},
});Don't forget to allow 'Less Secure Apps' from account security options, if sending via Gmail.
Usage
Send mail
let options={
to: '[email protected]',
from: '[email protected]',
subject: "Test message",
text: "Test",
html: "<div>Test</div>"
};
await strapi.plugins['email'].services.email.send(options);Reconfigure provider
let newProviderOptions= {
host: 'smtp.gmail.com', //SMTP Host
port: 465 , //SMTP Port
secure: true,
username: '[email protected]',
password: 'my.password',
rejectUnauthorized: true,
requireTLS: true,
connectionTimeout: 1,
};
await strapi.plugins.email.provider.reinit(newProviderOptions);