Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending email from Nuxt site using the Strapi email plugin #102

Closed
ozed-dev opened this issue Feb 4, 2021 · 2 comments
Closed

Sending email from Nuxt site using the Strapi email plugin #102

ozed-dev opened this issue Feb 4, 2021 · 2 comments
Labels
question Further information is requested

Comments

@ozed-dev
Copy link

ozed-dev commented Feb 4, 2021

Is it possible to?

I just need to send data from the contact form on the site to the administrative email. I don't want to create a separate service for this, especially since Strapy has his own solution. But I don't understand how to use it directly from the frontend.

As far as I can see, we do not have access to $strapi.plugins['email']... I can only create a collection like Messages. Then submit the new post to the collection from the contact form. And on the Strapi side create a trigger (idk how) for sending a letter when a new post created in this collection?

Am I thinking right? Maybe there is some simpler solution or a ready-made example of such an approach?

@ozed-dev ozed-dev added the question Further information is requested label Feb 4, 2021
@mctweb
Copy link

mctweb commented Feb 11, 2021

You could just add a new route to an existing collection. Then link this route to a new controller, which you call your email service from. There is no need to add a whole collection unless you plan on storing these emails in your database.

@benjamincanac
Copy link
Member

@vogordin The Email plugin adds a send route which you can use directly from your frontend:

await this.$strapi.$http.$post('/email', { to: '', subject: ``, text: `` })

Don't forget to authorize this route in your Strapi Admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants