-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.php
More file actions
31 lines (25 loc) · 837 Bytes
/
mail.php
File metadata and controls
31 lines (25 loc) · 837 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
<?php
$emailTo = "carpini.davide@gmail.com"; // Enter your email for feedbacks here
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: ".$_POST['email']."\r\n";
if (!isset($_POST['subject'])) {
$subject = "Contact form message from davidecarpini.com:"; // Enter your subject here
} else {
$subject = $_POST['subject'];
}
reset($_POST);
$body = "";
$body .= "<p><b>Name: </b>".$_POST['name']."</p>";
$body .= "<p><b>Email: </b>".$_POST['email']."</p>";
$body .= "<p><b>Subject: </b>".$subject."</p>";
$body .= "<p><b>Message: </b>".$_POST['message']."</p>";
if( mail($emailTo, $subject, $body, $headers) ){
$mail_sent = true;
} else {
$mail_sent = false;
}
if(!isset($resp)){
echo json_encode($mail_sent);
}
?>