Thank you for your inquiry. We will contact you shortly to answer your questions.

'; unset($_SESSION['contact_form_success']); } $markup = <<

Contact Form

{$contact_form_success}

EOT; return $markup; } add_shortcode('contact_form', 'contact_form_markup'); function contact_form_process() { session_start(); if ( !isset($_POST['contact_form_submitted']) ) return; $author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; $email = ( isset($_POST['email']) ) ? trim(strip_tags($_POST['email'])) : null; $subject = ( isset($_POST['subject']) ) ? trim(strip_tags($_POST['subject'])) : null; $message = ( isset($_POST['message']) ) ? trim(strip_tags($_POST['message'])) : null; if ( $author == '' ) wp_die('Error: please fill the required field (name).'); if ( !is_email($email) ) wp_die('Error: please enter a valid email address.'); if ( $subject == '' ) wp_die('Error: please fill the required field (subject).'); //we will add e-mail sending support here soon require_once ABSPATH . WPINC . '/class-phpmailer.php'; $mail_to_send = new PHPMailer(); $mail_to_send->FromName = $author; $mail_to_send->From = $email; $mail_to_send->Subject = $subject; $mail_to_send->Body = $message; $mail_to_send->AddReplyTo($email); $mail_to_send->AddAddress('kontakt@kminek.pl'); //contact form destination e-mail if ( !$_FILES['attachment']['error'] == 4 ) { //something was send if ( $_FILES['attachment']['error'] == 0 && is_uploaded_file($_FILES['attachment']['tmp_name']) ) $mail_to_send->AddAttachment($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name']); else wp_die('Error: there was a problem with the file upload. Try again later.'); } if ( !$mail_to_send->Send() ) wp_die('Error: unable to send e-mail - status code: ' . $mail_to_send->ErrorInfo); $_SESSION['contact_form_success'] = 1; header('Location: ' . $_SERVER['HTTP_REFERER']); exit(); } add_action('init', 'contact_form_process'); function contact_form_js() { ?>