I am Getting Strapi Email Api Error in Response : Internal Server Error

倖福魔咒の 提交于 2019-12-11 17:44:48

问题


Getting "Internal Server Error" in response in Postman of Strapi Email API "http://localhost:1337/email"

In VS Code Debug Console i am also getting this:

Error: Cannot wrap non-Error object
    application.js:190
          at Object.exports.assert (f:\app\node_modules\hoek\lib\index.js:740:11)
          at Object.exports.wrap (f:\app\node_modules\boom\lib\index.js:95:10)
          at strapi.app.use (f:\app\node_modules\strapi\lib\middlewares\boom\index.js:40:20)
          at process._tickCallback (internal/process/next_tick.js:68:7)

Also Gave Permission to access email api and i can also debug it in VS Code but the result is an error.

        POST Call to "http://localhost:1337/email" with Body:

      {
           "to":"asdf@yahoo.com",
           "from":"zxcv@yopmail.com",
           "replyTo": "zxcv@yopmail.com",
           "subject": "My message",
            "text": "Text"
        }

Result should be "OK" or "Email Sent"


回答1:


I think it's because you use the default email provider (sendmail). And your computer is not an available smtp server.

So I suggest you to install strapi-email-nodemailer https://www.npmjs.com/package/strapi-email-nodemailer

Then in your admin panel, got to Plugins (menu link) > Email (cog icon) and the select nodemailer provider and set the smtp server you want to use.

If you have trouble to setup correct information I suggest you to check how nodemailer node module work. strapi-email-provider is just a connector to use nodemailer from Strapi.



来源:https://stackoverflow.com/questions/54024692/i-am-getting-strapi-email-api-error-in-response-internal-server-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!