Universal email 3 - Attachment won't send with jquery form validation
Hello, I have UE3 & can't get the attachment to send when I have jquery form validation on the page, it sends the email but no attachment. It works fine if there is no form validation. What is preventing the attachment being sent? Here's my page code. Thanks Chris.
<?php require_once("webassist/email/mail_php.php"); ?> <?php require_once("webassist/email/mailformatting_php.php"); ?> <?php if (!isset($_SESSION))session_start(); if ((isset($_POST["submit"]))) { //WA Universal Email object="mail" set_time_limit(0); $EmailRef = "waue_test_universal_email_attachment_3"; $BurstSize = 200; $BurstTime = 1; $WaitTime = 1; $GoToPage = ""; $RecipArray = array(); $StartBurst = time(); $LoopCount = 0; $TotalEmails = 0; $RecipIndex = 0; // build up recipients array $CurIndex = sizeof($RecipArray); $RecipArray[$CurIndex] = array(); $RecipArray[$CurIndex ][] = "timespider@hotmail.com"; $TotalEmails += sizeof($RecipArray[$CurIndex]); $RealWait = ($WaitTime<0.25)?0.25:($WaitTime+0.1); $TimeTracker = Array(); $TotalBursts = floor($TotalEmails/$BurstSize); $AfterBursts = $TotalEmails % $BurstSize; $TimeRemaining = ($TotalBursts * $BurstTime) + ($AfterBursts*$RealWait); if ($TimeRemaining < ($TotalEmails*$RealWait) ) { $TimeRemaining = $TotalEmails*$RealWait; } $_SESSION[$EmailRef."_Total"] = $TotalEmails; $_SESSION[$EmailRef."_Index"] = 0; $_SESSION[$EmailRef."_Remaining"] = $TimeRemaining; while ($RecipIndex < sizeof($RecipArray)) { $EnteredValue = is_string($RecipArray[$RecipIndex][0]); $CurIndex = 0; while (($EnteredValue && $CurIndex < sizeof($RecipArray[$RecipIndex])) || (!$EnteredValue && $RecipArray[$RecipIndex][0])) { $starttime = microtime_float(); if ($EnteredValue) { $RecipientEmail = $RecipArray[$RecipIndex][$CurIndex]; } else { $RecipientEmail = $RecipArray[$RecipIndex][0][$RecipArray[$RecipIndex][2]]; } $EmailsRemaining = ($TotalEmails- $LoopCount); $BurstsRemaining = ceil(($EmailsRemaining-$AfterBursts)/$BurstSize); $IntoBurst = ($EmailsRemaining-$AfterBursts) % $BurstSize; if ($AfterBursts<$EmailsRemaining) $IntoBurst = 0; $TimeRemaining = ($BurstsRemaining * $BurstTime * 60) + ((($AfterBursts<$EmailsRemaining)?$AfterBursts:$EmailsRemaining)*$RealWait) - (($AfterBursts>$EmailsRemaining)?0:($IntoBurst*$RealWait)); if ($TimeRemaining < ($EmailsRemaining*$RealWait) ) { $TimeRemaining = $EmailsRemaining*$RealWait; } $CurIndex ++; $LoopCount ++; session_commit(); session_start(); $_SESSION[$EmailRef."_Index"] = $LoopCount; $_SESSION[$EmailRef."_Remaining"] = round($TimeRemaining); session_commit(); wa_sleep($WaitTime); include("webassist/email/waue_test_universal_email_attachment_3.php"); $endtime = microtime_float(); $TimeTracker[] =$endtime - $starttime; $RealWait = array_sum($TimeTracker)/sizeof($TimeTracker); if ($LoopCount % $BurstSize == 0) { $TimePassed = (time() - $StartBurst); if ($TimePassed < ($BurstTime*60)) { $WaitBurst = ($BurstTime*60) -$TimePassed; wa_sleep($WaitBurst); } else { $TimeRemaining = ($TotalEmails- $LoopCount)*$RealWait; } $StartBurst = time(); } if (!$EnteredValue) { $RecipArray[$RecipIndex][0] = mysql_fetch_assoc($RecipArray[$RecipIndex][1]); } } $RecipIndex ++; } $_SESSION[$EmailRef."_Total"] = 0; $_SESSION[$EmailRef."_Index"] = 0; $_SESSION[$EmailRef."_Remaining"] = 0; session_commit(); session_start(); if ($GoToPage!="") { header("Location: ".$GoToPage); } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="CSS/validate.css"> <script src="jquery-1.4.4.js" type="text/javascript"></script> <script src="jquery.validate.js"></script> <script> $(function(){ $("#myForm").validate({ rules:{ name: { required:true }, gender: { required:true }, age: { required:true }, raceexperience: { required:true }, whywin: { required:true }, email: { required:true }, phone: { required:true }, live: { required:true }, bike: { required:true }, agree: { required:true } } }); }); </script> <style type="text/css"> <!-- body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; } --> </style></head> <body> <table width="415" border="0" cellpadding="4" cellspacing="0" bgcolor="#FF3333"> <tr> <td><form action="" method="post" enctype="multipart/form-data" name="myForm" id="myForm"> <table width="415" border="1" cellspacing="0" cellpadding="4"> <tr> <td><label for="label">Name</label></td> <td><input type="text"id="name" name="name"/></td> </tr> <tr> <td><label for="label">Gender</label></td> <td> <input id="male" type="radio" name="gender" value="male" /> male</label> <input id="female" type="radio" name="gender" value="female" /> female</label></td> </tr> <tr> <td><label for="label">Age</label></td> <td><input type="text" id="age" name="age" maxlength="3"/></td> </tr> <tr> <td><label for="label">Race experience/results</label></td> <td><textarea id="raceexperience" name="raceexperience" cols="25" rows="5"></textarea></td> </tr> <tr> <td><label for="label">Why you should win</label></td> <td><textarea id="whywin" name="whywin" cols="25" rows="5"></textarea></td> </tr> <tr> <td><label for="label">Email</label></td> <td><input type="text" id="email" name="email"/></td> </tr> <tr> <td><label for="label">Phone number</label></td> <td><input type="text" id="phone" name="phone"/></td> </tr> <tr> <td><label for="label">Where do you live</label></td> <td><input type="text" id="live" name="live"/></td> </tr> <tr> <td><label for="label">Current bike</label></td> <td><input type="text" id="bike" name="bike"/></td> </tr> <tr> <td><label for="label">Photo of you on bike</label></td> <td><label for="photo"></label> <input type="file" name="file" id="photo"/></td> </tr> <tr> <td><label for="label">I have read & agree to the terms</label></td> <td><input type="checkbox" id="agree" name="agree"/></td> </tr> <tr> <td colspan="2"><div align="right"> <input name="submit" type="submit"? /> </div></td> </tr> </table> </form></td> </tr> </table> </body> </html>