Skip to content

Email plugin is not working #6543

@jay01011986

Description

@jay01011986

Describe the bug
Email plugin is not working and I am getting errors while sending the email. I have tried with multiple providers like Sendgrid, mailgun and mailtrap etc and same issue is coming.
I have followed the following link to do the setup:
https://strapi.io/documentation/v3.x/plugins/email.html#programmatic-usage

This is the error log on Strapi console:

AssertionError [ERR_ASSERTION]: Cannot wrap non-Error object
      at new AssertionError (internal/assert.js:396:11)
      at Object.exports.assert (/Users/Jay/Desktop/Temp/StrapiTemp1/my-project/node_modules/hoek/lib/index.js:559:11)
      at Function.boomify (/Users/Jay/Desktop/Temp/StrapiTemp1/my-project/node_modules/boom/lib/index.js:107:14)
      at formatBoomPayload (/Users/Jay/Desktop/Temp/StrapiTemp1/my-project/node_modules/strapi/lib/middlewares/boom/index.js:47:22)
      at strapi.app.use (/Users/Jay/Desktop/Temp/StrapiTemp1/my-project/node_modules/strapi/lib/middlewares/boom/index.js:84:36)
      at processTicksAndRejections (internal/process/next_tick.js:81:5)

These are the setups, I have used in config/plugins.js:

module.exports = ({ env }) => ({
  email: {
    provider: 'sendgrid',
    providerOptions: {
      apiKey: env('API_KEY'),
    },
    settings: {
      defaultFrom: 'mrityunjay.tiwari@awrostamani.com',
      defaultReplyTo: 'mrityunjay.tiwari@awrostamani.com',
    },
  },
});

Steps to reproduce the behavior

  1. Install the new default Strapi project:
    yarn create strapi-app my-project --quickstart
  2. add the sendgrid package:
    yarn add strapi-provider-email-sendgrid --save
  3. add plugins.js under config folder with the following setup:
module.exports = ({ env }) => ({
  email: {
    provider: 'sendgrid',
    providerOptions: {
      apiKey: env('API_KEY'),
    },
    settings: {
      defaultFrom: 'mrityunjay.tiwari@awrostamani.com',
      defaultReplyTo: 'mrityunjay.tiwari@awrostamani.com',
    },
  },
});

yarn develop and try to send the mail from postman using the following service:
http://localhost:1337/email

{
        "to": "jay01011986@gmail.com",
        "subject": "Comment posted that contains a appriciations",
        "text": "testing"
 }

Expected behavior
A mail should be triggered.

System

  • Node.js version: 13.12.0
  • NPM version: 0.34.0
  • Strapi version: 3.0.1
  • Database: mssql
  • Operating system: MacOS Catalina

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions