问题
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