IsSMTP(); $mail->Host = 'cir93342_MASTER'; $mail->Port = 25; $mail->SMTPAuth = false; $mail->SMTPSecure = 'ssl'; $mail->Subject = stripslashes($subject); $mail->From = $mailfrom; $mail->FromName = $mailfrom; $mailto_array = explode(",", $mailto); for ($i = 0; $i < count($mailto_array); $i++) { if(trim($mailto_array[$i]) != "") { $mail->AddAddress($mailto_array[$i], ""); } } if (!ValidateEmail($mailfrom)) { $error .= "The specified email address (" . $mailfrom . ") is invalid!\n
"; throw new Exception($error); } $mail->AddReplyTo($mailfrom); $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { $logdata .= ','; if (is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; $logdata .= implode("|", $value); } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; $value = str_replace(",", " ", $value); $logdata .= $value; } } } $logdata = str_replace("\r", "", $logdata); $logdata = str_replace("\n", " ", $logdata); $logdata .= "\r\n"; $handle = fopen($csvFile, 'a') or die("can't open file"); $logtime = date("Y-m-d H:i:s,"); fwrite($handle, $logtime); fwrite($handle, $_SERVER['REMOTE_ADDR']); fwrite($handle, $logdata); fclose($handle); $mail->CharSet = 'UTF-8'; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if (is_array($_FILES[$key]['name'])) { $count = count($_FILES[$key]['name']); for ($file = 0; $file < $count; $file++) { if ($_FILES[$key]['error'][$file] == 0) { $mail->AddAttachment($_FILES[$key]['tmp_name'][$file], $_FILES[$key]['name'][$file]); } } } else { if ($_FILES[$key]['error'] == 0) { $mail->AddAttachment($_FILES[$key]['tmp_name'], $_FILES[$key]['name']); } } } } $mail->WordWrap = 80; $mail->Body = $message; $mail->Send(); header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'layoutgrid4') { $mailto = 'yourname@yourdomain.com'; $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $subject = 'Website form'; $message = 'Values submitted from web site form:'; $success_url = ''; $error_url = ''; $eol = "\n"; $error = ''; $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response", "h-captcha-response"); $boundary = md5(uniqid(time())); $header = 'From: '.$mailfrom.$eol; $header .= 'Reply-To: '.$mailfrom.$eol; $header .= 'MIME-Version: 1.0'.$eol; $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol; $header .= 'X-Mailer: PHP v'.phpversion().$eol; try { if (!ValidateEmail($mailfrom)) { $error .= "The specified email address (" . $mailfrom . ") is invalid!\n
"; throw new Exception($error); } $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=UTF-8'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'layoutgrid6') { $mailto = 'test@iriologiasur.com'; $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $subject = 'Resuktados Testeo'; $message = 'Values submitted from web site form:'; $success_url = ''; $error_url = ''; $eol = "\n"; $error = ''; $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response", "h-captcha-response"); $boundary = md5(uniqid(time())); $header = 'From: '.$mailfrom.$eol; $header .= 'Reply-To: '.$mailfrom.$eol; $header .= 'MIME-Version: 1.0'.$eol; $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol; $header .= 'X-Mailer: PHP v'.phpversion().$eol; try { if (!ValidateEmail($mailfrom)) { $error .= "The specified email address (" . $mailfrom . ") is invalid!\n
"; throw new Exception($error); } $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=UTF-8'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } ?> Untitled Page
Button