Horje
how to send email Code Example
how to send email
import React, { useRef } from "react";
import emailjs from "@emailjs/browser";

const ContactUs = () => {
  const form = useRef();

  const num =(Math.floor(Math.random() * 1000));

  const sendEmail = (e) => {
    e.preventDefault();

    emailjs
      .sendForm("gmail", "test-temp", e.target, "v8vKjhc4544PvRhT-")
      .then(
        (result) => {
          console.log(result);
        },
        (error) => {
          console.log(error.text);
        }
      );

    e.target.reset();
  };

  return (
    <form ref={form} onSubmit={sendEmail}>
      <label>Subject</label>
      <input type="text" name="subject" />

      <label>Name</label>
      <input type="text" name="name" />

      <label>Email</label>
      <input type="email" name="email" />

      <label>Send to</label>
      <input type="email" name="to_email" />

      <label>Message</label>
      <pre class="easycode; title:;lang:;"><xmp name="message" />

      <input name="randomNum" defaultValue={num}/>

      <input type="submit" value="Send" />
    </form>
  );
};

export default ContactUs;




Javascript

Related
'userprofile/:id', ionic Code Example 'userprofile/:id', ionic Code Example
groupby angular Code Example groupby angular Code Example
javascript to typescript converter tool Code Example javascript to typescript converter tool Code Example
is game development with javscript wrth it ? Code Example is game development with javscript wrth it ? Code Example
react native get uri of the image in the app assets folder Code Example react native get uri of the image in the app assets folder Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7