I configured mailer to use sendgrid. I’m happy to make it work in local on my machine, but since i’m deploying to my production server, it doesn’t work.
The values in .env files are the same.
I also tried with the api key directly in app/config/plugins.js
Does someone has an idea ?
–
here is the log
App 32297 output: Error: Couldn't send test email: Unauthorized.
App 32297 output: at Object.test (/home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/plugin-email/server/controllers/email.js:50:15)
App 32297 output: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
App 32297 output: at async returnBodyMiddleware (/home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/services/server/compose-endpoint.js:45:20)
App 32297 output: at async policiesMiddleware (/home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/services/server/policy.js:16:9)
App 32297 output: at async /home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/services/server/compose-endpoint.js:29:16
App 32297 output: at async /home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/middlewares/body.js:51:17
App 32297 output: at async /home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/middlewares/logger.js:7:9
App 32297 output: at async /home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/middlewares/powered-by.js:10:9
App 32297 output: at async cors (/home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@koa/cors/index.js:107:16)
App 32297 output: at async /home/jhev9121/nodevenv/admin-dko/18/lib/node_modules/@strapi/strapi/dist/middlewares/errors.js:9:13
In my case, adding IP to Allow Listed IP Addresses isn’t working
Error: Couldn't send test email: Unauthorized.
at Object.test (/home/username/workspace/appname/node_modules/@strapi/plugin-email/dist/server/index.js:173:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async returnBodyMiddleware (/home/username/workspace/appname/node_modules/@strapi/strapi/dist/services/server/compose-endpoint.js:42:18)
at async policiesMiddleware (/home/username/workspace/appname/node_modules/@strapi/strapi/dist/services/server/policy.js:15:5)
at async /home/username/workspace/appname/node_modules/@strapi/strapi/dist/services/server/compose-endpoint.js:27:12
at async /home/username/workspace/appname/node_modules/@strapi/strapi/dist/middlewares/body.js:45:9
at async /home/username/workspace/appname/node_modules/@strapi/strapi/dist/middlewares/logger.js:6:5
at async /home/username/workspace/appname/node_modules/@strapi/strapi/dist/middlewares/powered-by.js:9:5
at async cors (/home/username/workspace/appname/node_modules/@koa/cors/index.js:107:16)
at async /home/username/workspace/appname/node_modules/@strapi/strapi/dist/middlewares/errors.js:8:7
this solution is working for my case with previous error messages for all environments. I have explicitly set Sendgrid API key with double quotes string in config/plugins.js rather than get it from an environment variable (in that case, it will be only working on local).