Strapi: Auth.form.error.email.invalid

Created on 19 Dec 2018  路  3Comments  路  Source: strapi/strapi

Informations

  • Node.js version: 10.x
  • NPM version: 6.x
  • Strapi version: v3.0.0-alpha.16
  • Database: mongoDB
  • Operating system: ubuntu

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();
            }
          });
        });
      }
    };
  }
};

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 馃憤

All 3 comments

@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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dorelljames picture dorelljames  路  3Comments

zhoub picture zhoub  路  3Comments

Rashidul420222 picture Rashidul420222  路  3Comments

derrickmehaffy picture derrickmehaffy  路  3Comments

mnlbox picture mnlbox  路  3Comments