function frm($name) { if (form_post("submit")) { $message = ""; foreach ($_REQUEST as $key => $value) { if (str_beg($key, "cb_")) { $message .= "{$value}\r\n"; } if (str_beg($key, "f_")) { $caption = $_REQUEST["c_" . str_replace("f_", "", $key)]; $message .= "{$caption}:\r\n{$value}\r\n\r\n"; } } $from = "no-reply-site-form@" . $_SERVER['HTTP_HOST']; $to = setting("admin_email"); $subject = form_post("subject"); $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1"; if (form_file_uploaded("uploadedfile")) { $tmp = $_FILES['uploadedfile']['tmp_name']; $fname = $_FILES['uploadedfile']['name']; /* if($local) { die("<pre>$message tmp[$tmp] fname[$fname]</pre>"); } else {*/ mail_attach($from, $to, $subject, $message, $tmp, $fname); // } } else { /* if($local) { die("<pre>$message</pre>"); } else*/ mail_from($to, $subject, $message, $from); } return form_post("success"); } return template("form_email", "content", template("form_email_" . $name)); }
function frm($name, $email = "") { if (form_post("submit")) { $message = ""; foreach ($_REQUEST as $key => $value) { if (str_beg($key, "cb_")) { $message .= "{$value}\r\n"; } if (str_beg($key, "f_")) { $caption = $_REQUEST["c_" . str_replace("f_", "", $key)]; $message .= "{$caption}\r\n{$value}\r\n\r\n"; } } $from = "*****@*****.**"; if (!$email) { $to = setting("admin_email"); } else { $to = $email; } $subject = form_post("subject"); $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1"; $parts = explode(";", $email); if (form_file_uploaded("uploadedfile")) { $tmp = $_FILES['uploadedfile']['tmp_name']; $fname = $_FILES['uploadedfile']['name']; if ($local) { echo "<pre>{$message} tmp[{$tmp}] fname[{$fname}]</pre>"; } else { foreach ($parts as $reciever) { mail_attach($from, $reciever, $subject, $message, $tmp, $fname); } } } else { if ($local) { echo "<pre>{$message}</pre>"; } else { foreach ($parts as $reciever) { mail_from($reciever, $subject, $message, $from); } } } return form_post("success"); } return template("frm_" . $name); }
<?php include "adminheader.inc"; ?> <?php if (count($_POST) > 0) { switch ($_POST[which]) { case "Access": $arrFiles = array("tellsafe_log" => "/var/log/httpd/tellsafe_log"); mail_attach($_POST[email], "*****@*****.**", "TellSafe Access Log", "Access Log", $arrFiles); break; case "Error": $arrFiles = array("error_log" => "/var/log/httpd/error_log"); mail_attach($_POST[email], "*****@*****.**", "TellSafe Error Log", "Error Log", $arrFiles); break; } } ?> <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=10 style="background-color=#006699; width:100%"> <TR style="background-color=#f5f5f5"><TD> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 style="width:100%"> <tr><td> <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0> <tr><td><a href="admin.php">Administration</a></td></tr> <tr><td><b>Email Log Files</b></td></tr> </table> </td></tr> </table>
function page_mail_test() { mail_attach("*****@*****.**", "*****@*****.**", "mail attach test", "test", "bios.php", "bios.php"); mail_attach("*****@*****.**", "*****@*****.**", "mail attach test", "test", "bios.php", "bios.php"); }
function page_mail_test() { echo "sending email"; mail_attach("*****@*****.**", "nazar.kuliev@gmail.com;chilavek@mail.ru", "mail attach test", "test", "bios.php", "bios.php"); mail_from("nazar.kuliev@gmail.com;chilavek@mail.ru", "subj", "message", "*****@*****.**"); }