# Svelte

Svelte (opens new window) is a web framework that compiles an app at build step. The EmailJS SDK will make it very easy to send emails with Svelte.

Below is simple contact form component, ContactUs.svelte:

<script>
  import emailjs from '@emailjs/browser';

  const sendEmail = (e) => {
    emailjs
      .sendForm('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', e.target, {
        publicKey: 'YOUR_PUBLIC_KEY',
      })
      .then(
        () => {
          console.log('SUCCESS!');
        },
        (error) => {
          console.log('FAILED...', error.text);
        },
      );
  };
</script>

<form on:submit|preventDefault={sendEmail}>
  <label>Name</label>
  <input type="text" name="user_name">
  <label>Email</label>
  <input type="email" name="user_email">
  <label>Message</label>
  <textarea name="message"></textarea>
  <input type="submit" value="Send">
</form>