Good morning,
I am writing for some help with a PHP form mailer I found online. The script works great and sends the email with attachment from my PC laptop (Windows 7, Firefox and IE) but when I send it from my MAC (OS X, Safari and Firefox) the form does not send the email at all. Also, my client tried out the form on his PC and it never sent the email either. How is this script only working on one of these three computers? Any help is very much appreciated!
I am writing for some help with a PHP form mailer I found online. The script works great and sends the email with attachment from my PC laptop (Windows 7, Firefox and IE) but when I send it from my MAC (OS X, Safari and Firefox) the form does not send the email at all. Also, my client tried out the form on his PC and it never sent the email either. How is this script only working on one of these three computers? Any help is very much appreciated!
PHP Code:
<?PHP
/*
Contact Form from HTML Form Guide
This program is free software published under the
terms of the GNU Lesser General Public License.
See this page for more info:
http://www.html-form-guide.com/contact-form/contact-form-attachment.html
*/
require_once("./include/fgcontactform.php");
require_once("./include/captcha-creator.php");
$formproc = new FGContactForm();
$captcha = new FGCaptchaCreator('scaptcha');
$formproc->EnableCaptcha($captcha);
//1. Add your email address here.
//You can add more than one receipients.
$formproc->AddRecipient('[email protected]'); //<<---Put your email address here
//2. For better security. Get a random tring from this link: http://tinyurl.com/randstr
// and put it here
$formproc->SetFormRandomKey('E6bZFICMgOhOnxI');
$formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024);
if(isset($_POST['submitted']))
{
if($formproc->ProcessForm())
{
$formproc->RedirectToURL("thank-you.php");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Order Form</title>
<link rel="STYLESHEET" type="text/css" href="contact.css" />
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<script type='text/javascript' src='scripts/fg_captcha_validator.js'></script>
</head>
<body>
<!-- Form Code Start -->
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'>
<fieldset >
<legend>Please Fill in the Details Below</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />
<div class='short_explanation'>* required fields</div>
<div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div>
<div class='fieldContainer'>
<span class="formText"><label for='name' >Your Full Name*: </label></span><br/>
<input name='name' type='text' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' size="65" maxlength="50" /><br/>
<span id='contactus_name_errorloc' class='error'></span>
</div>
<div class='fieldContainer'>
<label for='bizName' >Business Name*: </label><br/>
<input name='bizName' type='text' id='bizName' value='<?php echo $formproc->SafeDisplay('bizName') ?>' size="65" maxlength="50" /><br/>
<span id='contactus_bizName_errorloc' class='error'></span>
</div>
<div style="width:700px; height:55px; padding:0; margin-top:8px; margin-bottom: 10px;">
<div style="width:235px; height:50px; float:left; padding:0;">
<span class="formText">Address*</span><br />
<input name='address' type='text' id='address' value='<?php echo $formproc->SafeDisplay('address') ?>' size="25" maxlength="50" /><br />
<span id='contactus_address_errorloc' class='error'></span></p>
</div>
<div style="width:190px; height:50px; float:left; padding:0;">
<span class="formText">City*</span><br />
<input name='city' type='text' id='city' value='<?php echo $formproc->SafeDisplay('city') ?>' size="25" maxlength="50" /><br />
<span id='contactus_city_errorloc' class='error'></span></p>
</div>
<div style="width:100px; height:50px; text-align:center; float:left;">
<span class="formText">State*</span><br />
<input name='state' type='text' id='state' value='<?php echo $formproc->SafeDisplay('state') ?>' size="4" maxlength="2" /><br />
<span id='contactus_state_errorloc' class='error'></span>
</div>
<div style="width:75px; height:50px; text-align:center; float:left;">
<span class="formText">Zipcode*</span><br />
<input name='zipcode' type='text' id='zipcode' value='<?php echo $formproc->SafeDisplay('zipcode') ?>' size="7" maxlength="5" /><br />
<span id='contactus_zipcode_errorloc' class='error'></span>
</div>
</div>
<div class='fieldContainer'>
<div style="width:350px; float:left; ">
<label for='email' >Email Address*:</label>
<br />
<input name='email' type='text' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' size="50" /><br />
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div style="width:225px; float:left; ">
<label for='phone' >Phone Number*:</label><br/>
<input name='phone' type='text' id='phone' value='<?php echo $formproc->SafeDisplay('phone') ?>' size="15" maxlength="12" />
<span class="fineprint">ex: 555-123-4567</span><br/>
<span id='contactus_phone_errorloc' class='error'></span></div>
</div>
<p> </p>
<div id="tableRow0">
<div id="tableRow1">
<div id="tableRow1-1"><span class="formText">Letterhead</span></div>
<div id="tableRow1-2"><label>
<select name="letterhead" id="letterhead">
<option value="None" selected="selected"></option>
<option value="70lb Bright White">70lb Bright White</option>
<option value="25% Cotton w/watermark">25% Cotton w/watermark</option>
<option value="Linen">Linen</option>
<option value="Laid">Laid</option>
<option value="30% recycled white">30% recycled white</option>
</select>
</label></div>
<div id="tableRow1-3">
</div>
<div id="tableRow1-4">
<label><span class="formText">QTY</span>
<select name="letterheadQty" id="letterheadQty">
<option value="0" selected="selected">0</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="1500">1500</option>
<option value="2000">2000</option>
<option value="2500">2500</option>
</select>
</label>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div id="tableRow1">
<div id="tableRow1-1">
<span class="formText">Envelopes</span></div>
<div id="tableRow1-2">
<label>
<select name="envelopes" id="envelopes">
<option value="None" selected="selected"></option>
<option value="#10 White Business">#10 White Business</option>
<option value="#9 Return">#9 Return Env</option>
<option value="6 3/4 white sm">6 3/4 white sm</option>
<option value="#10 Window">#10 Window </option>
<option value="#10 Security">#10 Security</option>
<option value="#10 Peal & Seal">#10 Peal & Seal</option>
<option value="#10 Peal & Seal Security">#10 Peal & Seal Security</option>
<option value="#10 Linen or Laid">#10 Linen or Laid</option>
<option value="#10 25% cotton watermarked">#10 25% cotton watermarked</option>
<option value="6x9 White Catalog">6x9 White Catalog</option>
<option value="6x9 Brown Catalog">6x9 Brown Catalog</option>
<option value="6x9 White Brochure">6x9 White Brochure</option>
<option value="9x12 White Catalog">9x12 White Catalog</option>
<option value="9x12 White Brochure">9x12 White Brochure</option>
<option value="10x13 White Catalog">10x13 White Catalog</option>
<option value="10x13 White Brochure">10x13 White Brochure</option>
<option value="10x15 White Catalog">10x15 White Catalog</option>
<option value="10x15 White Brochure">10x15 White Brochure</option>
</select>
</label>
</div>
<div id="tableRow1-3">
</div>
<div id="tableRow1-4">
<label><span class="formText">QTY</span>
<select name="envelopesQty" id="envelopesQty">
<option value="0" selected="selected">0</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="1500">1500</option>
<option value="2000">2000</option>
<option value="2500">2500</option>
</select>
</label>
</div>
</div>
<div class="clear"></div>
<div id="tableRow1">
<div id="tableRow1-1">
<span class="formText">Business Cards</span></div>
<div id="tableRow1-2">
<label>
<select name="businessCards" id="businessCards">
<option value="None" selected="selected"></option>
<option value="Std 80lb White Card Black Ink">Std 80lb White Card Black ink</option>
<option value="Std 80lb White Card 1 color ink">Std 80lb White Card 1 Color ink</option>
<option value="Std 80lb White Card Full Color">Std 80lb White Card Full Color</option>
<option value="14pt Full color Glossy photo card">14pt Full color Glossy Photo card</option>
</select>
</label>
</div>
<div id="tableRow1-3"> </div>
<div id="tableRow1-4">
<label><span class="formText">QTY</span>
<select name="businessCardsQty" id="businessCardsQty">
<option value="0" selected="selected">0</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</label></div>
</div>
<div class="clear"></div>
<div id="tableRow1">
<div id="tableRow1-1">
<span class="formText">Carbonless</span>
</div>
<div id="tableRow1-2">
<label>
<select name="carbonless" id="carbonless">
<option value="None" selected="selected"></option>
<option value="2 Part">2 Part</option>
<option value="3 Part">3 Part</option>
<option value="4 Part">4 Part</option>
<option value="5 Part">5 Part</option>
</select>
</label></div>
<div id="tableRow1-3"> </div>
<div id="tableRow1-4">
<label><span class="formText">QTY</span>
<select name="carbonlessQty" id="carbonlessQty">
<option value="0" selected="selected">0</option>
<option value="250 Sets">250 Sets</option>
<option value="500 Sets">500 Sets</option>
<option value="1000 Sets">1000 Sets</option>
</select>
</label>
</div>
</div>
<div class="clear"></div>
<div id="tableRow1">
<div id="tableRow1-1"><span class="formText">Copies</span></div>
<div id="tableRow1-2">
<label>
<select name="copies" id="copies">
<option value="None" selected="selected"></option>
<option value="1 Side B&W">1 side B&W</option>
<option value="2 sides B&W">2 sides B&W</option>
<option value="1 side color">1 side color</option>
<option value="2 sides color">2 sides color</option>
</select>
</label>
</div>
<div id="tableRow1-3">
</div>
<div id="tableRow1-4">
<label><span class="formText">QTY</span>
<select name="copiesQty" id="copiesQty">
<option value="0" selected="selected">0</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="1500">1500</option>
<option value="2000">2000</option>
<option value="2500">2500</option>
<option value="5000">5000</option>
</select>
</label></div>
</div>
<div class="clear"></div>
<div id="tableRow1">
<div id="tableRow1-1"><span class="formText">Postcards</span></div>
<div id="tableRow1-2">
<label>
<select name="postcards" id="postcards">
<option value="None" selected="selected"></option>
<option value="80lb White-Blk ink 4x6 1 side">80lb White-Blk ink 4x6 1 side</option>
<option value="80lb White-Blk ink 4x6 2 sides">80lb White -Blk ink 4x6 2 sides</option>
<option value="14pt Full color 2 sides 4x6">14pt Full Color 2 sides 4x6</option>
<option value="other size">other size</option>
</select>
</label></div>
<div id="tableRow1-3"> </div>
<div id="tableRow1-4">
<label><span class="formText">QTY</span>
<select name="postcardsQty" id="postcardsQty">
<option value="0" selected="selected">0</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="2500">2500</option>
<option value="5000">5000</option>
</select>
</label>
</div>
</div>
</div><!-- end tableRow0 -->
<p> </p>
<p> </p>
<div class='container'>
<label for='message'><span class="formText">Please include any comments or special instructions we should know about:</span></label><br/>
<span id='contactus_message_errorloc' class='error'></span>
<span class="alignCenter"><textarea rows="5" cols="100" name='message' id='message'><?php echo $formproc->SafeDisplay('message') ?></textarea></span>
</div>
<div style="width:600px; height:60px; text-align:center">
<label for='photo' >Attach Your Art File:</label><br/>
<input type="file" name='photo' id='photo' /><br/>
<span id='contactus_photo_errorloc' class='error'></span>
</div>
<div class='container'>
<div align="center"><img alt='Captcha image' src='show-captcha.php?rand=1' id='scaptcha_img' /></div>
<div style="text-align:center"><label for='scaptcha' >Enter the code above here:</label>
<span class="alignCenter"><input type='text' name='scaptcha' id='scaptcha' maxlength="10" /></span><br/>
<span class="alignCenter"><span id='contactus_scaptcha_errorloc' class='error'></span></span></div>
<div class='short_explanation'>Can't read the image?
<a href='javascript: refresh_captcha_img();'>Click here to refresh</a>.</div>
</div>
<div class='container'>
<p style="text-align:center"><input type='submit' name='Submit' value='Submit' /></p>
</div>
</fieldset>
</form>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->
<script type='text/javascript'>
// <![CDATA[
var frmvalidator = new Validator("contactus");
frmvalidator.EnableOnPageErrorDisplay();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("bizName","req","Please provide your business's name.");
frmvalidator.addValidation("email","req","Please provide your email address");
frmvalidator.addValidation("phone","req","Please provide a contact number.");
frmvalidator.addValidation("address","req","Please provide your shipping address.");
frmvalidator.addValidation("city","req","Please provide your city.");
frmvalidator.addValidation("state","req","Please fill in.");
frmvalidator.addValidation("zipcode","req","Please fill in.");
frmvalidator.addValidation("message","maxlen=2048","The exceeds the maximum limit. Please go back and shorten, then submit again. Thank you!");
frmvalidator.addValidation("photo","file_extn=jpg;jpeg;gif;png;bmp;tif;tiff;eps;ai;pdf;ppt;pptx;doc;docx;","File format is not supported. Please upload one of the following formats: jpg, jpeg, gif, png, bmp, tiff, tiff, eps, ai, pdf, ppt, pptx, doc, docx.");
frmvalidator.addValidation("scaptcha","req","Please enter the code in the image above");
document.forms['contactus'].scaptcha.validator
= new FG_CaptchaValidator(document.forms['contactus'].scaptcha,
document.images['scaptcha_img']);
function SCaptcha_Validate()
{
return document.forms['contactus'].scaptcha.validator.validate();
}
frmvalidator.setAddnlValidationFunction("SCaptcha_Validate");
function refresh_captcha_img()
{
var img = document.images['scaptcha_img'];
img.src = img.src.substring(0,img.src.lastIndexOf("?")) + "?rand="+Math.random()*1000;
}
// ]]>
</script>
</body>
</html>
Comment