aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail.php
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail.php')
-rw-r--r--mail/mail.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/mail/mail.php b/mail/mail.php
new file mode 100644
index 0000000..f07087f
--- /dev/null
+++ b/mail/mail.php
@@ -0,0 +1,32 @@
+<?php
+
+// Check for empty fields
+if(empty($_POST['nombre']) ||
+ empty($_POST['correo']) ||
+ empty($_POST['mensaje']) ||
+ !filter_var($_POST['correo'],FILTER_VALIDATE_EMAIL))
+{
+ return false;
+}
+
+$name = strip_tags(utf8_decode(htmlspecialchars($_POST['nombre'])));
+$email_address = strip_tags(htmlspecialchars($_POST['correo']));
+$message = strip_tags(utf8_decode(htmlspecialchars($_POST['mensaje'])));
+
+// Create the email and send the message
+$to = 'user@domain.at'; // Add your email address
+$email_subject = <<<EOT
+[heckyel.ga] Mensaje de {$name}
+EOT;
+$email_body = <<<EOT
+Haz recibido un nuevo mensaje del formulario de contacto de tu sitio web.\n\n
+Aqui estan los detalles:\n\n
+Nombre: {$name}\n\n
+Email: {$email_address}\n\n
+Mensaje:\n
+{$message}
+EOT;
+$headers = "From: noreply@heckyel.ga\n"; // Using something like noreply@yourdomain.com.
+$headers .= "Reply-To: $email_address";
+mail($to,$email_subject,$email_body,$headers);
+return true;