-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmail.php
More file actions
executable file
·53 lines (39 loc) · 1.09 KB
/
mail.php
File metadata and controls
executable file
·53 lines (39 loc) · 1.09 KB
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
51
52
53
<?php
// variable
$fromemail = 'any_site@my_site_com'; // from mail
$to = "[email protected]"; // to mail
// check data
$fields = $_POST["fields"];
if (!isset($_POST["fields"])) {
die("No data");
}
if( empty($fields['first_name']) ) {
die("No first name");
}
if( empty($fields['last_name']) ) {
die("No last name");
}
if( empty($fields['email']) ) {
die("No email address");
}
if( empty($fields['phone']) ) {
die("No phone number");
}
if (!empty( $fields['code'] ) ) {
die("ok");
}
// content massage
$from = 'Mail from'."<".$fromemail.">";
$message = "<b>Client name: </b> " . $fields['first_name'] . " " . $fields['last_name'] . "<br>";
$message .= "<b>Client email: </b> " . $fields['email'] . "<br>";
$message .= "<b>Client phone: </b> " . $fields['phone'] . "<br>";
$message .= "Sent: ".strftime("%a, %d %b %Y %H:%M:%S");
// end content massage
$headers = "Content-type: text/html; charset=utf-8 \r\n";
$headers .= "From: Site Mail <" . $fromemail . ">\r\n";
if(mail($to, $message, $headers)){
print 'The message was successfully sent';
} else {
print 'Email not send';
}
?>