—module.exports = {
async index(ctx) {
console.log(“ctx”,ctx);
await strapi.plugins[‘email’].services.email.send({
to: “hello@gmail.com”, // this is to be fetched from nextjs input field how ?
from:"yyyyy@gmail.com",
subject: “Subscribe”,
text: “Thanks for subscribing”,
});
ctx.send(“Email Sent”);
}
}
If this ia custom controller you can use ctx.body
to get the content of the body where the input is.
This email is a GET request so how we can access body
Well if it’s dynamic you need to send the data so you need to make it a POST request
but when i send post request then text is not displayed in the body of the email
So i think the setup is a bit different,
this is using email, and depending on how you set it up currently I use AWS SES for it but others are also possible to use.