Questions / Diagnosing problems

Why do my website's contact form emails go to spam?

Short answer

Most contact forms send mail with the visitor's address in the From line. But your website's server sent it, not the visitor's mail provider. Nothing matches, so the message looks fake. Send from an address on your own domain, set up that domain's records, and put the visitor's address in Reply-To.

The detail

You build a contact form. A visitor fills it in. The message to you never shows up, or it sits in your spam folder. This is one of the most common ways a small site hits spam trouble.

Why it happens

A contact form is a small program on your website. When someone submits it, your website's server sends an email to you.

The easy way to write that email is to copy the visitor's address into the From line. It feels natural. The message is from them, after all.

But your server isn't the visitor's mail provider. The visitor's domain never said your server may send for it. Yahoo asks that the domain in the From line be aligned with either the SPF domain or the DKIM domain.[1] Here, neither one lines up.

Google's guidance adds a plain rule: don't impersonate other domains or senders without permission.[2] A form that puts a stranger's address in From does just that, even though it means no harm.

Four steps. A visitor types their address into your contact form. Your website's server sends you a message. The message says From the visitor's address, though your server is not theirs. The checks fail for that domain, and your own inbox may send it to spam.
A form that borrows the visitor's address as the sender looks like a fake.

Our page on what DMARC is explains why that match matters.

A second cause: the server isn't in your records

Sometimes the form does use your own address, and it still fails. Often the mail leaves through a server your domain's records don't mention.

Google says your SPF record should include all email senders for your domain.[2] It also says that if your third-party senders aren't in the record, their messages are more likely to be marked as spam.[2] A hosting company's mail server, or a form plugin's service, counts as a sender.

The fix

  1. Send from your own domain. Pick an address such as [email protected]. Use it as the From line on every form message.
  2. Put the visitor in Reply-To. The standard says this field shows where the author suggests replies be sent.[3] When you hit Reply, your mail app writes to the visitor. You don't need their address in From.
  3. Add the sender to your records. Find which server or service sends the form's mail. Then add it to your SPF record, and turn on DKIM signing for it if it offers that.
  4. Send a test, then read the headers. Submit the form yourself. Our page on reading email headers shows where to find the SPF and DKIM results.
Two boxes. Before: From is the visitor's address, sent by your server, and nothing matches. After: From is forms@example.com, Reply-To is the visitor's address, SPF and DKIM are set up for example.com, and replies still go to the visitor.
Send from your own domain and put the visitor in Reply-To.

Many form plugins and sending services have a setting for the From address. Look for it before you change any code.

What if the message still goes to spam?

Work through the usual checks. Look at how spam filters decide, and check for a blocklist listing on your sending server. If your form mail goes to a Gmail address, the same rules apply there.

Sources

  1. Sender best practices, Yahoo (accessed 2026-11-08)
  2. Email sender guidelines, Google (Gmail Help) (accessed 2026-11-08)
  3. RFC 5322: Internet Message Format, IETF (accessed 2026-11-08)