-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathemail.php
More file actions
executable file
·65 lines (61 loc) · 2.2 KB
/
email.php
File metadata and controls
executable file
·65 lines (61 loc) · 2.2 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
54
55
56
57
58
59
60
61
62
63
64
65
<?php
$message = "";
if (isset($_POST['send'])) {
// Initialize Variables
$from = strip_tags($_POST['from']);
$to = strip_tags($_POST['to']);
$cc = strip_tags($_POST['cc']);
$bcc = strip_tags($_POST['bcc']);
$reply_to = strip_tags($_POST['reply_to']);
$subject = strip_tags($_POST['subject']);
$body = strip_tags($_POST['body']);
// Format mail headers
$headers = 'From: ' . $from . "\r\n";
if ( isset($cc) ) { $headers .= 'CC: ' . $cc . "\r\n"; }
if ( isset($bcc) ) { $headers .= 'BCC: ' . $bcc . "\r\n"; }
if ( isset($reply_to)) { $headers .= 'Reply-To: ' . $reply_to . "\r\n"; }
$headers .= 'X-Mailer: PHP/' . phpversion();
// Send mail
if ( mail($to,$subject,$body,$headers)) {
$message = "<br>Message Successfully Sent\n";
} else {
$message = "<br>Error: Unable to Send Message\n";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Email Example</title>
<style>
TD {
font: 10pt helvetica, sans-serif;
border: thin solid black;
}
TH {
font: bold 10pt helvetica, sans-serif;
border: thin solid black;
}
</style>
</head>
<body>
<h1>Email Example</h1>
<p> </p>
<form name="SMTP" method=POST>
<table border=0>
<tr><th>From</th><td><input name="from" type=text size=40 maxlength=255 value="<?php echo @$from; ?>" /></td></tr>
<tr><th>To</th><td><input name="to" type=text size=40 maxlength=255 value="<?php echo @$to; ?>" /></td></tr>
<tr><th>CC</th><td><input name="cc" type=text size=40 maxlength=255 value="<?php echo @$cc; ?>" /></td></tr>
<tr><th>Reply To</th><td><input name="reply_to" type=text size=40 maxlength=255 value="<?php echo @$reply_to; ?>" /></td></tr>
<tr><th>Subject</th><td><input name="subject" type=text size=80 maxlength=255 value="<?php echo @$subject; ?>" /></td></tr>
<tr><td colspan=2><textarea name="body" rows="8" cols="80"><?php echo @htmlentities($_POST['body']); ?></textarea></td></tr>
<tr><td colspan=2><input type=submit name="send" value="SEND"></td></tr>
</table>
</form>
<br>
<?php echo "<br>$message<br>"; ?>
<br><a href="index.php">BACK</a>
<?php phpinfo(INFO_VARIABLES); ?>
</body>
</html>