-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmailformtest.php
More file actions
39 lines (39 loc) · 1.03 KB
/
Copy pathmailformtest.php
File metadata and controls
39 lines (39 loc) · 1.03 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
<html>
<head><title>MailForm Test</title>
</head>
<body>
<?php
if (isset($_POST['submit']))
{
// Process Form
$Name = "Thomas";
$email = $_POST['sender']; //senders e-mail adress
$recipient = $_POST['recipient']; //recipient
$mail_body = "The text for the mail..."; //mail body
$subject = $_POST['subject']; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
mail($recipient, $subject, $mail_body, $header, '-f thfl@dr.dk'); //mail command :)
echo("Mail sent to ");
echo($recipient);
echo(" from ");
echo($email);
echo(".");
?>
<br />
<a href="mailformtest.php">return to form</a>
<?php
}
else
{
?>
<form action="mailformtest.php" method="post">
Sender: <input type="text" name="sender" id="sender" value="noreply@dr.dk" /><br />
Receiver: <input type="text" name="recipient" id="recipient" value="thfl@dr.dk" /><br />
Subject: <input type="text" name="subject" id="subject" value="Subject for email" /><br />
<input type="submit" value="Send" name="submit" id="submit" />
</form>
<?php
}
?>
</body>
</html>