-
Notifications
You must be signed in to change notification settings - Fork 1
/
sendemail.php
executable file
·39 lines (29 loc) · 1.05 KB
/
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
31
32
33
34
35
36
37
38
39
<?php
/*======================================
= PHP send email =
======================================*/
$email = "[email protected]"; /* add your email */
$headerFields = array(
"From: [email protected]", /* add your email */
"MIME-Version: 1.0",
"Content-Type: text/html;charset=utf-8"
);
$log_data['ip'] = $_SERVER['HTTP_X_REAL_IP'];
$log_data['userAgent'] = $_SERVER["HTTP_USER_AGENT"];
$log_data['post_data'] = $_POST;
if (isset($_POST['comments'])) {
$mailText = '
IP: '.$log_data['ip'].'<br />
User agent: '.$log_data['userAgent'].'<br />
ContactName: '.$_POST['contactName'].'<br />
Email: '.$_POST['email'].'<br />
Comments: '.$_POST['comments'].'<br />
';
if ( mail($email, 'Contact form webpage 1E-shop by www.angelostudio.net.', $mailText, implode("\r\n", $headerFields) ) ) {
error_log(serialize($log_data)."\n", 3, '_log/contact.log');
} else {
error_log(serialize($log_data)."\n", 3, '_log/contact_error.log');
}
}
/*----- End of PHP send email ------*/
?>