# Serverless Email Forms

How to build HTML forms that submit directly to email. No sign-up or server required.

Have you ever wondered how to submit form data on static or serverless websites? With MailSlurp forms you can get form data sent directly to your email address - even files! You don't need an account and no server or Javascript is required.

# 1. Create a form with a MailSlurp action

You can get form data sent to your email from any HTML page. Simply create an HTML form with method="post" and action"=https://api.mailslurp.com/forms"

<form action="https://api.mailslurp.com/forms" method="post">
  <!-- inputs will go here -->
</form>

# 2. Add the inputs you want to collect

Add the inputs you wish to collect and give them a name.

<form action="https://api.mailslurp.com/forms" method="post">
  <!-- add some inputs with names -->
  <input name="birthday" placeholder="Please enter your birthday" />
  <button type="submit">Submit</button>
</form>

# 3. Add your email address in a hidden field

To tell MailSlurp where to send the form results add a hidden input field with name="_to" and set the value to your email address.

<form action="https://api.mailslurp.com/forms" method="post">
  <!-- add your email as a hidden `_to` field -->
  <input type="hidden" name="_to" value="YOUR_EMAIL_ADDRESS" />
  <!-- data fields -->
  <input name="birthday" placeholder="Please enter your birthday" />
  <button type="submit">Submit</button>
</form>

# 4. Receive the results to your email

That's it! Now try submitting the form. MailSlurp will read the form values and send them to the email address specified.

TIP

You can control form redirect behaviour using a _redirectTo field. Alternatively provide a success message with _successMessage.

To include file attachments use <input type="file" name="file"> and set the form attribute enctype="multipart/form-data". For more configuration options see the Forms Documenation.