简体   繁体   中英

Send a form without using endpoint

in order to use this npm package, i need an api endpoint, but what if i want to send this with smtp?

I do not have experience with this kind of package, so i will appreciate your help!

The package is: https://www.npmjs.com/package/@betahuhn/feedback-js

my actual code so far:

const options = {
      id: 'feedback', // id to identify the form on the backend
      endpoint: baseUrl, // enpoint of your backend to handle the submission
      emailField: true, // show email input field, default: false
      btnTitle: 'Feedback', // title of button
      title: 'Company Feedback', // text at the top
      contactText: 'Or send an email!', // text for other contact option
      contactLink: Contact, // link for other contact option
      typeMessage: 'What feedback do you have?', // message for selecting feedback type
      success: 'Thanks! 👊', // message displayed on successfull submission
      failedTitle: 'Oops, an error ocurred!', // title displayed on error
      failedMessage: 'Please try again. If this keeps happening, try to send an email instead.', // default error message if backend doesn't return one
      position: 'right', // position of button left/right
      primary: 'rgb(53, 222, 118)', // primary color
      background: '#fff', // background color
      color: '#000' // font color
    }
    console.log(Contact);
    console.log(baseUrl);
      new Feedback(options).attach();

  })

how can i send this in the simpliest ways possible?

You need an endpoint because a code has to process your form, an HTML form is just a static thing that's only obligated to deliver data to some script.

If you don't want to spend your time on writing an API endpoint you can try form endpoint services like formcarry which allows you to collect submissions without any back-end code

If you want to write your own endpoint, then you can follow this detailed blog post

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM