This project is a production-ready contact form developed in PHP, designed to be integrated into a client website.
Unlike a generic contact form where the message is sent to an arbitrary recipient, this implementation sends all messages to a fixed email address configured in the backend, which is the standard behavior for website contact forms.
The sender’s email is collected to allow replies, not to define the destination.
- Recipient email is configured in PHP
- Sender email is provided by the user
- Designed for real-world website usage
- Multi-layer validation:
- HTML5 required fields
- JavaScript client-side validation
- PHP server-side validation
- Fixed recipient email configuration
- Clean and readable PHP code
- Centralized message handling
- Easy to integrate and customize
- Email sending via PHP
mail()
To set the recipient email address, edit the following file: php/enviar-mail
Update the $to variable:
$to = 'your-email@example.com'; // Replace with the desired recipient- PHP
- JavaScript
- HTML5
- CSS
- Form handling
- Server-side validation
- Reusable and maintainable structure
index.php— Contact form UIjs/form_mail.js— Client-side validationphp/enviar-mail.php— Server-side validation and email sendingphp/mensajes.php— Centralized response messagescss/estilos.css— Styling
- Intended for use in real websites
- Easily adaptable to different designs
- Focused on clarity and maintainability
Pablo Garay
Personal website