-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendemail.php
30 lines (26 loc) · 916 Bytes
/
sendemail.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
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Thank you for contact us. As early as possible we will contact you ',
'status'=>true
);
$error= array(
'type'=>'error',
'message'=>'Something went wrong, Please try aagain. ',
'status'=>false
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = $email;
$email_to = '[email protected]';//replace with your email
$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
if($success){
echo json_encode($status);
}else{
echo json_encode($status);
}
die;