-
Notifications
You must be signed in to change notification settings - Fork 0
/
contactengine.php
37 lines (32 loc) · 905 Bytes
/
contactengine.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
<?php
$EmailFrom = "[email protected]";
$EmailTo = "[email protected]";
$Subject = "Message from Backyard visitor";
$Name = Trim( stripslashes( $_POST[ 'Name' ] ) );
$Email = Trim( stripslashes( $_POST[ 'Email' ] ) );
$Message = Trim( stripslashes( $_POST[ 'Message' ] ) );
// validation
$validationOK = true;
if ( !$validationOK ) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail( $EmailTo, $Subject, $Body, "From: <$EmailFrom>" );
// redirect to success page
if ( $success ) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
} else {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}