-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform2mail.php
More file actions
41 lines (32 loc) · 759 Bytes
/
form2mail.php
File metadata and controls
41 lines (32 loc) · 759 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
31
32
33
34
35
36
37
38
39
40
41
<?php
if(isset($_POST["submit"))
{
$info = $_POST;
$info["subject"] = isset($info["subject"])?$info["subject"]:"No subject";
$info["from"] = isset($info["from"])?$info["from"]:ini_get("sendmail_from");
$info["to"] = isset($info["to"])?$info["to"]:null;
if(!is_null($info["to"]))
{
$to = $info["to"];
unset($info["to"]);
$subject = $info["subject"];
unset($info["subject"]);
$send = "";
foreach($info as $name => $value)
{
if(is_array($value))
{
// In case multiple-choice like checkbox
$value = implode(", ",$value);
}
$tempString = "$name = $value \r\n";
$send.=$tempString;
}
mail($to, $subject, $send);
}
else
{
// React to no reciever here...
}
}
?>