splitforms.com

Contact form · Ruby on Rails

Contact form for Ruby on Rails

Add a working contact form to a Rails app without Action Mailer, SMTP settings or a new model and migration. Use form_with in an ERB view to post straight to splitforms, or relay from a controller with Net::HTTP. Submissions are saved to your dashboard with spam filtering.

  • 500 free / month
  • One endpoint
  • No backend code
Ruby on Rails contact form — copy-paste code for splitforms

Key benefits

No backend code

No server, API route, or SDK. Your Ruby on Rails form posts straight to one endpoint.

Straight to your inbox

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it reaches you.

Design without limits

It's your own Ruby on Rails markup and styles. Splitforms is only the backend, so nothing constrains how the form looks.

Copy-paste ready

Your Ruby on Rails contact form, ready to paste.

Replace YOUR_ACCESS_KEY with the key from your dashboard — that's the whole integration. No SDK to install, no build step, just the erb you already write.

contact.html
<%# app/views/pages/contact.html.erb %>
<%# Posts straight to splitforms. No Action Mailer, model or SMTP needed. %>
<%= form_with url: "https://splitforms.com/api/submit", method: :post,
      authenticity_token: false, data: { turbo: false } do |form| %>
  <%= form.hidden_field :access_key, value: "YOUR_ACCESS_KEY" %>

  <%= form.label :name, "Name" %>
  <%= form.text_field :name, placeholder: "Your name", required: true %>

  <%= form.label :email, "Email" %>
  <%= form.email_field :email, placeholder: "you@example.com", required: true %>

  <%= form.label :message, "Message" %>
  <%= form.text_area :message, rows: 4, placeholder: "Your message...", required: true %>

  <%# Honeypot: a plain input, because form.check_box adds a hidden botcheck=0 field %>
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off" />

  <button type="submit">Send Message</button>
<% end %>

How to add it

How to add a contact form to a Ruby on Rails website.

To add a contact form to a Ruby on Rails website you need three things: a free splitforms access key, the erb snippet above, and your key pasted into it. No backend, server, or SDK — the form posts to one URL and every submission lands in your inbox and dashboard.

  1. Get your free splitforms access key

    Sign up at splitforms.com, verify your email, and copy your access key from the dashboard. No credit card required.

  2. Drop the Ruby on Rails snippet into your project

    Copy the Ruby on Rails code example into your project and replace YOUR_ACCESS_KEY with the key from step 1.

  3. Receive submissions in your dashboard

    Submissions arrive in the splitforms dashboard within seconds. Free includes owner email notification attempts; Pro adds Slack, Discord, Sheets, or any signed webhook URL.

Where submissions go

Where do your Ruby on Rails form submissions go?

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it ever reaches you. Search, export to CSV, or forward it to a webhook or Slack on Pro.

  • 500 submissions a month, free to start
  • Honeypot + automatic spam scoring on every plan
  • Signed webhooks to Slack, Discord, your server
Ruby on Rails contact form submissions in the splitforms dashboard

No backend needed

Do you need a backend for a Ruby on Rails form? No.

Your Ruby on Rails form posts standard FormData to one URL. Splitforms validates the access key, runs its spam checks, and forwards it to your email — so there's no server, API route, or database for you to build or maintain.

  • Uses form_with in any ERB view, or relays from a controller
  • No Action Mailer, SMTP settings, model or migration to add
  • Honeypot field plus the built-in spam filter
How splitforms processes a Ruby on Rails form submission

Best practices

What a production-ready Ruby on Rails form needs.

The difference between a form that works in the demo and one that survives launch traffic — the production-tested defaults, in priority order.

  • Store the access key in an environment variable or Rails credentials when you relay through a controller.
  • Set open_timeout and read_timeout on Net::HTTP so a slow network does not hold up a Puma thread.
  • Use a plain checkbox for the botcheck honeypot and forward it unchanged when relaying.
Production-ready Ruby on Rails contact form best practices

Questions

Ruby on Rails contact form questions.

Anything missing? Email us, we read every message.

A person reading answers to common questions
How do I add a contact form to Rails without Action Mailer?

Use form_with url: "https://splitforms.com/api/submit" in your view with a hidden access_key field. Each submission is saved in your splitforms dashboard and an email notification is attempted to the form owner, so you never configure SMTP.

Why does my Rails honeypot mark every submission as spam?

form.check_box adds a hidden field with the value 0, so the honeypot is never empty. Use a plain HTML checkbox named botcheck instead, as in the example above.

Does protect_from_forgery block forms that post to splitforms?

No. Rails checks the authenticity token only on requests to your own app. A form that posts straight to splitforms never reaches Rails, so pass authenticity_token: false to leave the unused token out.

Can I validate params in Rails before forwarding them?

Yes. Post the form to your own controller, validate the params, then forward them plus access_key with Net::HTTP. See the controller example above.

form.check_box adds a hidden 0 value

Rails' check_box helper writes a hidden input with the same name and the value 0 so an unticked box still sends something. On the honeypot that hidden value would mark every real submission as spam, so use a plain <input type="checkbox" name="botcheck"> instead.

Skip the authenticity token on external forms

form_with adds a hidden authenticity_token field by default. It only matters to your own Rails app, so pass authenticity_token: false when the form posts to splitforms. Keep it when you relay through your own controller.

Show 1 more questions
Turn off Turbo for the external form

With Turbo Drive installed, add data: { turbo: false } to form_with so the browser does a normal form submission to splitforms and follows the redirect, instead of Turbo trying to handle the cross-site response.

View all FAQs

Ship your Ruby on Rails contact form in 60 seconds.

Free to start on 500 submissions a month. Need Slack alerts, signed webhooks, or file uploads? Pro unlocks them for $5/mo — so you only pay once you outgrow free.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form