How to add a contact form linking to an email


My client doesn’t want to give out their email address on their website. Instead they want a contact form (name, email, message) which will get sent to their email address.

It’s a static HTML website, using Surreal CMS.

How do I do this?


Mark, does your web hosting provider support PHP? You can write a simple PHP script to send form submissions to your client’s email address.


PHP is one way. A third-party service such as FormKeep is another (many of these services have free tiers).

Yet another way is through a provider such as Postmark or Amazon Simple Email Service, but those will require a bit of backend setup first.


Thanks Jeremy and Cory.

The PHP route looks out of my comfort zone. I can see numerious PHP scripts available for free, but I don’t have the faintest idea how to implement them or if there are security issues.

FormKeep is $60 a year just for one contact form. I’m struggling to find a free alternative that doesn’t have a logo/ad on the form.

Nearly all of my clients have asked for a contact form. Fortunately I’ve been able to convincce them to simply give their email address.

However, is a contact form (submitted and emailed to the client) something that Surreal CMS could offer in the future?


I’ve looked into this and consulted with some third-party providers. The thing that makes it difficult isn’t form handling — it’s dealing with spam.

The other factor is, traditionally, Surreal has never managed infrastructure or assets for its users. This was a design choice to prevent users from being locked-in, so adding form handling would contradict that.

All in all, it’s a good idea but unless Surreal is also managing your hosting it probably makes more sense to just use a third-party provider.


Hi Cory.

Many thanks for looking into this.

I don’t have a clue what I’m taking about, but all I was looking for is for the form to be emailed to an email address. No database, no backend. Is this outside the remit of Surreal?

I think everyone I have worked for has asked for this sort of contact form. I think it’s because people fear that they will get a load of spam if they state their email address on their website.

… so perhaps instead of a contact form, I should be offering some sort of anti spam protection on their email address? Is it possible to display the email address so that it can be read by a human, but to a spambot harvesting emails it is scrambled?



Contact forms are indeed a pretty standard thing to have on a website. Each approach has pros and cons. The reason they don’t exist in Surreal is because we don’t manage your infrastructure. Things like forms, analytics, etc. are left to the designer. Many choose third-party apps to handle them, others roll their own solution.

so perhaps instead of a contact form, I should be offering some sort of anti spam protection on their email address?

I’d still recommend a proper contact form. They’re more professional than just an email link. There are lots of tutorials for DIY solutions and form endpoint services are super easy to setup.


Hi Mark,

I would recommend using a PHP script for the contact form. You don’t need to worry about security or spam if you build the form correctly.

I can help you with this if need be. Please send me a private message.

Yes, there are several techniques out there that allow you to do this. Many use JavaScript or encode the email address.