View Single Post
Old 10-31-2012, 10:50 PM   PM User | #10
bhamilto66
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bhamilto66 is an unknown quantity at this point
It took me forever to figure this one out...

Change your MailHandler.php code to look like the below or just cut and paste this code. Note: make sure you are entering a valid email address on the HTML contact form or it will not work, I tested with my yahoo account email address.

PHP Code:
<?php
    $owner_email 
"YourEmailAddressHere@xxx.com";
    
$headers 'From:' $_POST["email"];
    
$subject 'A message from your site visitor ' $_POST["name"];
    
$messageBody "";
    
    if(
$_POST['name']!='nope'){
        
$messageBody .= '<p>Visitor: ' $_POST["name"] . '</p>' "\n";
        
$messageBody .= '<br>' "\n";
    }
    if(
$_POST['email']!='nope'){
        
$messageBody .= '<p>Email Address: ' $_POST['email'] . '</p>' "\n";
        
$messageBody .= '<br>' "\n";
    }else{
        
$headers '';
    }
    if(
$_POST['state']!='nope'){        
        
$messageBody .= '<p>State: ' $_POST['state'] . '</p>' "\n";
        
$messageBody .= '<br>' "\n";
    }
    if(
$_POST['phone']!='nope'){        
        
$messageBody .= '<p>Phone Number: ' $_POST['phone'] . '</p>' "\n";
        
$messageBody .= '<br>' "\n";
    }    
    if(
$_POST['fax']!='nope'){        
        
$messageBody .= '<p>Fax Number: ' $_POST['fax'] . '</p>' "\n";
        
$messageBody .= '<br>' "\n";
    }
    if(
$_POST['message']!='nope'){
        
$messageBody .= '<p>Message: ' $_POST['message'] . '</p>' "\n";
    }
    
    if(
$_POST["stripHTML"] == 'true'){
        
$messageBody strip_tags($messageBody);
    }
    
        
mail($owner_email$subject$messageBody$headers)

?>

Last edited by VIPStephan; 11-01-2012 at 08:29 AM.. Reason: added code BB tags
bhamilto66 is offline   Reply With Quote