Informations
What is the current behavior?
I want to send confirmation email. ( with default SendMail provider)
I enable email confirmation at Roles & Permissions
Send Post Request localhost:1337/auth/local/register
with
password
email
in result I got this
{"statusCode":400,"error":"Bad Request","message":[{"messages":[{"id":"Auth.form.error.email.invalid"}]}]}
User was created but email was not send.
Suggested solutions
First I was thinking that is problem of default template of Email address confirmation
where field Response email
is empty. But it didn't help me.
Also I tried to put emails in fields which are default empty here: Plugins>Email>configutation (Sendmail Default From and Sendmail Default Reply-To) - also didn't help me.
Btw in previous versions it was working fine.
error comes from here:
/plugins/email/node_modules/strapi-provider-email-sendmail/lib/index.js
Code:
'use strict';
/**
* Module dependencies
*/
// Public node modules.
const _ = require('lodash');
const sendmail = require('sendmail')({
silent: true
});
/* eslint-disable no-unused-vars */
module.exports = {
provider: 'sendmail',
name: 'Sendmail',
auth: {
sendmail_default_from: {
label: 'Sendmail Default From',
type: 'text'
},
sendmail_default_replyto: {
label: 'Sendmail Default Reply-To',
type: 'text'
}
},
init: (config) => {
return {
send: (options, cb) => {
return new Promise((resolve, reject) => {
// Default values.
options = _.isObject(options) ? options : {};
options.from = options.from || config.sendmail_default_from;
options.replyTo = options.replyTo || config.sendmail_default_replyto;
options.text = options.text || options.html;
options.html = options.html || options.text;
sendmail({
from: options.from,
to: options.to,
replyTo: options.replyTo,
subject: options.subject,
text: options.text,
html: options.html
}, function (err) {
if (err) {
reject([{ messages: [{ id: 'Auth.form.error.email.invalid' }] }]);
} else {
resolve();
}
});
});
}
};
}
};
Please check this issue https://github.com/strapi/strapi/issues/2126
@lauriejim documentation is pretty weak there. Maybe I can get more infomation how configurate that provider? (strapi-email-nodemailer). Thanks a lot 馃憤
@lauriejim greatly appreciate if the instruction of setting up strapi-email-nodemailer can be provided. thanks!
Most helpful comment
@lauriejim documentation is pretty weak there. Maybe I can get more infomation how configurate that provider? (strapi-email-nodemailer). Thanks a lot 馃憤