-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail_test.php
More file actions
30 lines (28 loc) · 737 Bytes
/
mail_test.php
File metadata and controls
30 lines (28 loc) · 737 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
<html>
<body>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = "Mail test" ;
$server = $_SERVER['HTTP_HOST'];
$message = "If you got this message, mail sending from $server is working fine :)" ;
mail( "$email", "$subject",
$message, "From: mailtest@" . $_SERVER['HTTP_HOST'] );
echo "Message has been sent to $email";
}
else
//if "email" is not filled out, display the form
{
$server = $_SERVER[HTTP_HOST];
echo "<h1>Mail test from $server</h1>
<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>
Enter Your Email: <input name='email' type='text' /><br /><br />
<input type='submit' name='Submit' value='Submit' />
</form>";
}
?>
</body>
</html>