[insert_php] if (isset($_POST[‘submit’])) {
$first_name = stripslashes($_POST[‘first_name’]);
$first_name = strip_tags($first_name);
$last_name = stripslashes($_POST[‘last_name’]);
$last_name = strip_tags($last_name);
$email = stripslashes($_POST[’email’]);
$email = strip_tags($email);
$company = stripslashes($_POST[‘company’]);
$company = strip_tags($company);
$date_now = date(“j M Y – h:i A”);

$errors = [];

if (strlen($first_name) < 3) { $errors[] = 'First Name must be 3 characters or more'; } if (strlen($last_name) < 3) { $errors[] = 'Last Name must be 3 characters or more'; } if (!preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $email)) { $errors[] = 'Email is invalid'; } if (strlen($company) < 3) { $errors[] = 'Company must be 3 characters or more'; } if ($errors) { echo '

Something was not quite right. Please correct any fields highlighted in red before trying again.

‘;
echo ‘

    ‘;
    foreach ($errors as $error) {
    printf(‘

  • %s
  • ‘, $error);
    }
    echo ‘

‘;
} else {
$to = “info@mindfulnessatwork.com”;
$from = “noreply@mindfulnessatwork.com”;
$subject = “[Downloads] ” . $first_name;
$headers = “From: ” . $from . “\r\n”;
$headers .= “Reply-To: ” . $from . “\r\n”;
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-Type: text/html; charset=ISO-8859-1\r\n”;

$message = ”;
$message .= ‘

‘;
$message .= ‘
‘;
$message .= ”;
$message .= ‘

‘;
$message .= ‘Mindfulness at Work‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ”;
$message .= ‘
‘;
$message .= ‘

‘;
$message .= ‘

The following person successfully received an auto-response from the server:

‘;
$message .= ‘

This auto-responder lets you know when someone has successfully received the download links for the audio.

‘;
$message .= ‘

‘;
$message .= ‘
‘;
$message .= ”;
$message .= ‘
‘;
$message .= ‘
‘;
$message .= ‘
‘;
$message .= ‘
‘;
$message .= ‘

Name: ‘ . $first_name . ‘ ‘ . $last_name . ‘
Email: ‘ . $email . ‘ Company: ‘ . $company . ‘ Course Start Date (YYYY, MM, DD): Timestamp: ‘ . $date_now . ‘

‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ”;
$message .= ‘
‘;
$message .= ‘

‘;
$message .= ‘

This email address is unmonitored. Please send your messages to info@mindfulnessatwork.com if you wish to get in touch with us.

‘;
$message .= ‘

‘;
$message .= ‘Contact Us‘;
$message .= ‘Terms‘;
$message .= ‘Privacy‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ”;

wp_mail($to, $subject, $message, $headers);

$message = ”;
$message .= ‘

‘;
$message .= ‘
‘;
$message .= ”;
$message .= ‘

‘;
$message .= ‘Mindfulness at Work‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ”;
$message .= ‘
‘;
$message .= ‘

‘;
$message .= ‘

Welcome ‘ . $first_name . ‘ to the download page for your Mindfulness Practice

‘;
$message .= ‘

Please click the link below to play the recording. To save the file please click on the file to open it in your browser then: in your browser click CTRL + S (Windows) or CMD + S (Mac OSX) to save. If you are on a mobile you are currently unable to save the files.
If you do not wish to download your files now, please ensure that you retain this email for your records to allow for any future download.

‘;
$message .= ‘

‘;
$message .= ‘

3-Step Breathing

‘;
$message .= ‘Listen to the 3-Step Breathing Audio‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ”;
$message .= ‘
‘;
$message .= ‘

‘;
$message .= ‘

This email address is unmonitored. Please send your messages to info@mindfulnessatwork.com if you wish to get in touch with us.

‘;
$message .= ‘

‘;
$message .= ‘Contact Us‘;
$message .= ‘Terms‘;
$message .= ‘Privacy‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ”;

if (wp_mail($email, $subject, $message, $headers)) {
echo “

Your download links have been emailed to you and should arrive within the next 10 minutes. Please check your spam/junk folder if you can’t see them before attempting to submit the form again.

“;
}
}
}
[/insert_php]

Subscribe to our bi-annual newsletter and receive our free 3-minute Mindfulness practice (please note it could take up to an hour to receive your download).