-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformulario.php
40 lines (31 loc) · 871 Bytes
/
formulario.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$enviado = false;
$exc = false;
if(isset($_POST['submit'])){
$nombre = $_POST['nombre'];
$correo = $_POST['correo'];
$asunto = $_POST['asunto'];
$mensaje = $_POST['mensaje'];
$nombre = trim($nombre);
$nombre = filter_var($nombre, FILTER_SANITIZE_STRING);
$correo = filter_var($correo, FILTER_SANITIZE_EMAIL);
$asunto = htmlspecialchars($asunto);
$asunto = filter_var($asunto, FILTER_SANITIZE_STRING);
$mesnaje = htmlspecialchars($mensaje);
$mensaje = trim($mensaje);
$mensaje = stripslashes($mensaje);
$enviar_a = '[email protected]';
$texto = "De: $nombre \n";
$texto .= "Correo: $correo \n";
$texto .= "$mensaje";
if($asunto == '' || $asunto == null){
$asunto = 'Mensaje de la página web';
}
try{
mail($enviar_a, $asunto, $texto);
$enviado=true;
}catch(Exception $e){
$exc=true;
}
}
?>