-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend-mail.php
More file actions
50 lines (37 loc) · 862 Bytes
/
Copy pathsend-mail.php
File metadata and controls
50 lines (37 loc) · 862 Bytes
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
41
42
43
44
45
46
47
48
49
50
<?php
// site owner
$to = "pablo.rodriguez@tajamar365.com";
$subject = trim( $_POST['subject'] );
// contact form fields
$name = trim( $_POST['name'] );
$email = trim( $_POST['email'] );
$message = trim( $_POST['message'] );
// check for error
$error = false;
if ( $name === "" )
{
$error = true;
}
elseif ( $email === "" )
{
$error = true;
}
elseif ( $message === "" )
{
$error = true;
}
// end check for error
// no error send mail
if ( !$error )
{
$body = "Name: $name \n\nEmail: $email \n\nMessage: $message";
$headers = 'From: ' . $name . ' <' . $email . '> ' . "\r\n" . 'Reply-To: ' . $email . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
mail( $to, $subject, $body, $headers );
echo 'success';
}
else
{
echo 'error';
}
// end no error send mail
?>