Contact Form [PHP]
Download Source CodeContactForm.20210309-1515.zip [Downloads: 403]
The contact form enables users of your website to make contact without you having to disclose your email address publicly. The receiving email is invisible to the user, at least until you choose to answer. The user can select to get a get a copy of the mail and the sender of this mail can be set to a no-reply address. The contact form uses Google's reCAPTCHA v3 to fight abusive traffic, like spam robots.
- Download zip package and unpack locally on your PC.
- The form uses Google's reCAPTCHA v3 to protect against spam.
Sign-up for reCAPTCHA v3 and get an API key pair for your domain: https://www.google.com/recaptcha/admin/create
- Edit ContactForm.php and change configuration:
- Enter the reCAPTCHA v3 key pair: Site key and secret key.
- The RECAP_THRESHOLD is default 0.5 and can be modified to suit your site. Also see https://developers.google.com/recaptcha/docs/v3
- Choose language: e.g. "en_US". If your language is not available you are welcome to make a translation; use an existing language file as template.
- Edit index.php and set the options in the constructor for ContactForm:
- Receiver e-mail address(es) by 'receivers': Multiple e-mails can be added comma separated. These are visible to each other but not to website users.
- Sender e-mail address by 'sender': This is shown as the from address for all sent mail including if the user selects to get a carbon copy.
Some webhosts require this to be an existing e-mail account on the hosting domain. Typically use a no-reply address.
- Set the reCAPTCHA Action by 'reCapAction': This will identify the form when viewing the reCAPTCHA Admin Console: https://www.google.com/recaptcha/admin
If not specified, the default of 'ContactFormSubmit' is used.
- Upload the folder to your webserver via FTP.
- Request the file contact/index.php in your webbrowser and test the system!