Send a form to your email6 min read
Send a website form to Gmail (and why mailto: fails)
Get form submissions in Gmail without mailto: links, app passwords or Apps Script, then label them, keep them out of spam and reply from Gmail.
Post the form to a form backend and add your Gmail address as the recipient; don't use a mailto: action, which only opens the visitor's mail app. Then add a Gmail filter for the sender so submissions skip spam and get their own label. Pressing Reply in Gmail writes to the visitor, from your own address.
What's different here
Gmail is a mailbox, not a sending service for your site. It has no URL a form can post to, so every route to Gmail goes through something else. The first thing most people try is mailto::
<form action="mailto:you@gmail.com" method="post" enctype="text/plain">
<input name="name" />
<input name="email" type="email" />
<textarea name="message"></textarea>
<button>Send</button>
</form>It does work, on your machine. You press Send, your mail app opens with the fields in the body, and you send it to yourself. A visitor's experience is different:
- The visitor presses Send. The browser doesn't post the form anywhere; it hands a mailto: link to the operating system.
- If no mail app or web handler is set up, which is common on work laptops and for Gmail users in the browser, nothing visible happens or the system asks which app to use.
- If one is set up, a draft opens in the visitor's own mail app with the fields pasted into the body.
- The visitor has to press Send a second time, from their own account. Many close the draft instead, and you never learn they tried.
When a message does get through, the body is raw name=value lines, because that's what text/plain encoding produces:
name=Ada Lovelace
email=ada@example.com
message=Hi, do you take on small bathroom jobs in March?The other routes to Gmail work, but each needs a server you run:
| Route | What it needs | Catch |
|---|---|---|
| Gmail SMTP with an app password | A server that runs code, and 2-Step Verification on the Google account | The password can send as you from anywhere, so it must never reach the browser. Google also limits how much a personal account sends a day |
Google Apps Script with MailApp | A script deployed as a web app | Personal accounts can email 100 recipients a day from scripts. The URL is public with no spam protection, so one bot can use it up |
| A form backend | The backend's URL in action | The email comes from the service's address, not yours. Reply-to fixes the part that matters |
Apps Script deserves a closer look, because it's the route most tutorials suggest. You write a doPost function, deploy it as a web app that anyone can call, and point the form at its URL. It works, but a plain form post leaves the visitor on a page served from Google's domain rather than yours, every bot that finds the URL can use up the day's quota, and the script runs as you, so a bug in it can email anyone from your account. You also own every change to the form's fields from then on.
Send the form to Gmail
Here's a form for a small trade business. The job field makes the inbox easy to scan, and email is named so replies go to the visitor:
<form action="https://ikiform.com/f/frm_xxxxxxxxxxxxxxxx" method="post">
<label for="name">Your name</label>
<input id="name" name="name" autocomplete="name" required />
<label for="email">Email for our reply</label>
<input id="email" name="email" type="email" autocomplete="email" required />
<label for="job">What do you need?</label>
<select id="job" name="job" required>
<option value="">Choose one</option>
<option value="repair">A repair</option>
<option value="quote">A quote for a new job</option>
<option value="other">Something else</option>
</select>
<label for="message">Details</label>
<textarea id="message" name="message" rows="5" required></textarea>
<input name="_gotcha" type="text" tabindex="-1" autocomplete="off" hidden />
<button>Send to our inbox</button>
</form>- Create a form in Ikiform and replace
frm_xxxxxxxxxxxxxxxxwith its id. - If you signed up with your Gmail address, you already get the emails as the workspace owner. Otherwise open the form's Notifications settings, enter the Gmail address under Add someone outside the workspace and press Send link.
- Open the confirmation email in Gmail and confirm. Until then the address shows Waiting for confirmation and gets nothing.
- Add your domain under the form's Allowed domains, publish the page and send a test.
Keep it out of spam with a Gmail filter
The first email from a new sender can land in Spam or Promotions. A filter on the sender fixes that for good. In Gmail, open the search options, put notifications@ikiform.com in From, press Create filter, then tick Never send it to Spam, Apply the label, Always mark it as important and Categorize as: Primary, which keeps it out of Promotions.
Or import the filter. This is the format Gmail's own filter Export writes; Google doesn't document it separately, so if an import fails, create the filter by hand as above. Save it as mailFilters.xml, then go to Settings, See all settings, Filters and Blocked Addresses, Import filters:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<title>Mail Filters</title>
<entry>
<category term="filter"></category>
<title>Mail Filter</title>
<content></content>
<apps:property name="from" value="notifications@ikiform.com"/>
<apps:property name="label" value="Website"/>
<apps:property name="shouldNeverSpam" value="true"/>
<apps:property name="shouldAlwaysMarkAsImportant" value="true"/>
<apps:property name="smartLabelToApply" value="^smartlabel_personal"/>
</entry>
</feed>Create the Website label first, or rename it in the file. One filter covers every form, because all notifications come from the same address. To split forms into different labels, filter on the subject instead, such as subject:("New submission: Quote request").
you+site@gmail.com as the recipient delivers to your normal inbox, and a filter on To can then tell site mail from everything else. It counts as an outside address, so it confirms by link like any other.Replying from Gmail
Gmail honours the reply-to header, so Reply addresses the visitor. Your answer goes out from your Gmail address, with Ikiform nowhere in the thread.
- To answer from your business address instead, add it under Settings, Accounts and Import, Send mail as, and pick it in the From line when you reply.
- Gmail may group notifications with the same subject into one conversation, because the subject is always
New submission:and the form's name. Turn off Conversation view in Gmail's settings if you'd rather see one row per message. - Hourly digests have no reply-to, since they cover many visitors. Reply to those from the dashboard's links.
Check it works
- Fill in the form on your page and submit it. You land on your thank-you page, or Ikiform's hosted one.
- Find the email in Gmail. It has your label and isn't in Spam or Promotions.
- Press Reply. The To line is the address typed in the form.
- Post with the honeypot filled in,
_gotcha=bot. It still gets a success answer, but the submission is stored as spam and sends no email or webhook. - Nothing arrived? Switch the dashboard's status filter to Spam. Spam gets the same success answer as a real submission.
Gotchas
- Google Workspace aliases. If the recipient is an alias or a Google Group, the group's own settings decide whether outside senders are allowed. Send a test before you rely on it.
- Confirmation goes to spam. The confirmation link email comes from Ikiform too. If it doesn't show up, look in Spam and mark it as not spam.
- Several Gmail addresses. Each form emails up to 10 addresses in all, and each outside address confirms separately.
- Old mailto: links elsewhere. A
mailto:link in your footer is fine as a link. The problem is onlymailto:as a form'saction.
Questions
Yes. A Workspace address works like any other recipient. If it's a Google Group or an alias, check that the group accepts mail from outside senders, then send a test.
A mailto: action never sends. It asks the visitor's device to open a mail app with a draft. If none is set up, nothing visible happens, and if one is, the visitor still has to press Send in it.
Only from a server you run, with an app password on an account that has 2-Step Verification. Never put that password in browser code; it can send mail as you.
Create a Gmail filter for mail from notifications@ikiform.com and tick Never send it to Spam. Apply a label at the same time, so form messages are easy to find.
Yes, when the form's email field is named email, email_address, your_email, reply_to, contact_email, or the form sends a _replyto field. Gmail then puts the visitor in the To line when you press Reply.
Stuck on a step, or want a guide for your situation? Email hello@ikiform.com.