Elevado Posted December 17, 2008 Share Posted December 17, 2008 Hello all, I'm new here and i'm also new in the php scripting.. I need some help with a 3rd party script i'm using for my contact page.. the problem is, it isn't working yet.. I found out that the problem is my own SMTP server, I have to add some script to pass the security.. Sorry for this extreme long post.. but I can't solve the problem and it's driving me nuts... could anyone please help me? The script is a bit in dutch but it shouldn't be the problem I think.. This is the script i'm using.. <?php ini_set('display_errors', 1); error_reporting(E_ALL); ob_start(); session_start(); // Config Gedeelte $cfg['url'] = "";// Site waarnaar je terug gaat als je een bericht hebt achtergelaten $cfg['naam'] = ""; // Webmaster naam $cfg['email'] = ""; // Webmaster E-mail $cfg['spam'] = 1; // Anti Spam Tijd in Minuten ( Voer "0" om de Spam Beveiliging uit te zetten ) $cfg['text'] = TRUE; // Bij Fout Text Rood maken ( TRUE voor aan, FALSE voor uit ) $cfg['input'] = TRUE; // Bij Fout Border om Vakje Rood maken ( TRUE voor aan, FALSE voor uit ) $cfg['HTML'] = TRUE; // Een HTML email ( TRUE voor aan, FALSE voor uit ) $cfg['CAPTCHA'] = FALSE; // CAPTCHA ( TRUE voor aan, FALSE voor uit ) // Hieronder niks meer veranderen // E-mail Checker / Validator function checkmail($email) { if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$", $email)) { return TRUE; } return FALSE; } $formulier = TRUE; if(!isset($_COOKIE['formulier'])) { if(isset($_POST['wis']) && ($_SERVER['REQUEST_METHOD'] == "POST")) { foreach($_POST as $key => $value) { unset($value); } header("Location: ".$_SERVER['PHP_SELF'].""); } if(isset($_POST['verzenden']) && ($_SERVER['REQUEST_METHOD'] == "POST")) { $aFout = array(); $naam = trim($_POST['naam']); $email = trim($_POST['email']); $onderwerp = trim($_POST['onderwerp']); $bericht = trim($_POST['bericht']); if($cfg['CAPTCHA']) { $code = $_POST['code']; } if(empty($naam) || (strlen($naam) < 3) || eregi("[<>]", $naam) ) { $aFout[] = "Er is geen naam ingevuld."; unset($naam); $fout['text']['naam'] = TRUE; $fout['input']['naam'] = TRUE; } if(empty($email)) { $aFout[] = "Er is geen e-mail adres ingevuld."; unset($email); $fout['text']['email'] = TRUE; $fout['input']['email'] = TRUE; } elseif(checkmail($email) == 0) // Wanneer je PHP 5.2 > gebruikt //elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $aFout[] = "Er is geen correct e-mail adres ingevuld."; unset($email); $fout['text']['email'] = TRUE; $fout['input']['email'] = TRUE; } if(empty($onderwerp)) { $aFout[] = "Er is geen onderwerp ingevuld."; unset($onderwerp); $fout['text']['onderwerp'] = TRUE; $fout['input']['onderwerp'] = TRUE; } if(empty($bericht)) { $aFout[] = "Er is geen bericht ingevuld."; unset($bericht); $fout['text']['bericht'] = TRUE; $fout['input']['bericht'] = TRUE; } if($cfg['CAPTCHA']) { if(strtoupper($code) != $_SESSION['captcha_code']) { $aFout[] = "Er is geen correcte code ingevuld."; $fout['text']['code'] = TRUE; $fout['input']['code'] = TRUE; } } if(!$cfg['text']) { unset($fout['text']); } if(!$cfg['input']) { unset($fout['input']); } if(!empty( $aFout )) { $errors = ' <div id="errors"> <ul>'; foreach($aFout as $sFout) { $errors .= " <li>".$sFout."</li>\n"; } $errors .= "</ul> </div>"; } else { $formulier = FALSE; if($cfg['HTML']) { // Headers $headers = "From: \"Contact Formulier\" <".$cfg['email'].">\r\n"; $headers .= "Reply-To: \"".$naam."\" <".$email.">\n"; $headers .= "Return-Path: Mail-Error <".$cfg['email'].">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $bericht = ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> </head> <body> <br /> <b>Naam:</b> '.$naam.'<br /> <b>Email:</b> <a href=\"mailto:'.$email.'\">'.$email.'</a><br /> <br /> <b>Bericht:</b><br /> '.$bericht.' <br /> <br /> <br /> --------------------------------------------------------------------------<br /> <b>Datum:</b> '.date("d-m-Y @ H:i:s").'<br /> <b>IP:</b> <a href=\"http://sunny.nic.com/cgi-bin/whois?domain='.$_SERVER['REMOTE_ADDR'].'\">'.$_SERVER['REMOTE_ADDR'].'</a><br /> <b>Host:</b> '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'<br /> </body> </html>'; } else { $bericht_wrap = wordwrap ($bericht, 40, "\n", 1); // Headers $headers = "From: \"Contact Formulier\" <".$cfg['email'].">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset='iso-8859-1'\n"; // Bericht $message = "Naam: ".$naam." \n"; $message .= "E-mail: ".$email." \n"; $message .= "Bericht:\n".$bericht_wrap." \n "; $message .= " \n "; $message .= "Datum: ".date("d-m-Y H:i:s")." \n"; $message .= "------------------------------------------------------- \n "; $message .= "IP: ".$_SERVER['REMOTE_ADDR']." \n "; $message .= "Host: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." \n "; } if(mail($cfg['email'], "[Contact] ".$onderwerp, $bericht, $headers)) { if(isset($_POST['stuurkopie'])) { $headers = "From: \"Contact Formulier\" <".$email.">\r\n"; $headers .= "Reply-To: \"".$naam."\" <".$email.">\n"; $headers .= "Return-Path: Mail-Error <".$email.">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; mail($email, "[Contact] ".$onderwerp, $bericht, $headers); } unset($naam, $email, $onderwerp, $bericht); setcookie("formulier", 1, time() + ( $cfg['spam'] * 60 ) ); echo " <p> Uw bericht is succesvol verzonden, er word zo snel mogelijk gereageerd.<br /> <br /> Met vriendelijke groeten,<br /> <b>".$cfg['naam']."</b> </p> "; } else { echo "Er is een fout opgetreden bij het verzenden van de email"; } header("refresh:3;url=".$cfg['url'].""); } } if($formulier) { ?> And this is a concept from my hosting provider to get passed the security.. <?php /* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */ function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) { //SMTP + SERVER DETAILS /* * * * CONFIGURATION START * * * */ $smtpServer = "mail.jouwdomein.nl"; $port = "25"; $timeout = "30"; $username = "webmaster@jouwdomein.nl"; $password = "geheim"; $localhost = "localhost"; $newLine = "\r\n"; /* * * * CONFIGURATION END * * * * */ //Connect to the host on the specified port $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout); $smtpResponse = fgets($smtpConnect, 515); if(empty($smtpConnect)) { $output = "Failed to connect: $smtpResponse"; return $output; } else { $logArray['connection'] = "Connected: $smtpResponse"; } //Request Auth Login fputs($smtpConnect,"AUTH LOGIN" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authrequest'] = "$smtpResponse"; //Send username fputs($smtpConnect, base64_encode($username) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authusername'] = "$smtpResponse"; //Send password fputs($smtpConnect, base64_encode($password) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authpassword'] = "$smtpResponse"; //Say Hello to SMTP fputs($smtpConnect, "HELO $localhost" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['heloresponse'] = "$smtpResponse"; //Email From fputs($smtpConnect, "MAIL FROM: $from" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailfromresponse'] = "$smtpResponse"; //Email To fputs($smtpConnect, "RCPT TO: $to" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailtoresponse'] = "$smtpResponse"; //The Email fputs($smtpConnect, "DATA" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['data1response'] = "$smtpResponse"; //Construct Headers $headers = "Content-type: text/plain".$newLine; //$headers = "MIME-Version: 1.0" . $newLine; //$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "To: $nameto <$to>" . $newLine; $headers .= "From: $namefrom <$from>" . $newLine; //fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n"); unix fputs($smtpConnect, "To: $to".$newLine."From: $from".$newLine."Subject: $subject".$newLine."$headers".$newLine.$newLine."$message".$newLine.".".$newLine); // windows $smtpResponse = fgets($smtpConnect, 515); $logArray['data2response'] = "$smtpResponse"; // Say Bye to SMTP fputs($smtpConnect,"QUIT" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['quitresponse'] = "$smtpResponse"; return TRUE; //print_r($logArray); } ?> Oh, and btw.... when i'm using the form on my page it is giving me this error report..: Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in .....\tijdelijk\contact.php on line 183 Er is een fout opgetreden bij het verzenden van de email Line 183 is the following: if(mail($cfg['email'], "[Contact] ".$onderwerp, $bericht, $headers)) { if(isset($_POST['stuurkopie'])) { $headers = "From: \"Contact Formulier\" <".$email.">\r\n"; $headers .= "Reply-To: \"".$naam."\" <".$email.">\n"; $headers .= "Return-Path: Mail-Error <".$email.">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; Thanks allready when you even take a look at all of this.. Grtz Marcel Quote Link to comment https://forums.phpfreaks.com/topic/137344-contact-page-not-working/ Share on other sites More sharing options...
JonnoTheDev Posted December 17, 2008 Share Posted December 17, 2008 Your script is still using the mail() function to send mail rather than your 3rd party function mail($email, "[Contact] ".$onderwerp, $bericht, $headers); Your new function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) Use the correct function parameters from your script Quote Link to comment https://forums.phpfreaks.com/topic/137344-contact-page-not-working/#findComment-717607 Share on other sites More sharing options...
Elevado Posted December 17, 2008 Author Share Posted December 17, 2008 so... correct me if i'm wrong.. I'm going to replace the part from line 183 with the new script? So it should be going to look a bit like this.. <?php ini_set('display_errors', 1); error_reporting(E_ALL); ob_start(); session_start(); // Config Gedeelte $cfg['url'] = "http://www.elevado-design.nl/tijdelijk";// Site waarnaar je terug gaat als je een bericht hebt achtergelaten $cfg['naam'] = "Elevado Design, Marcel Zijlstra"; // Webmaster naam $cfg['email'] = "website@elevado-design.nl"; // Webmaster E-mail $cfg['spam'] = 1; // Anti Spam Tijd in Minuten ( Voer "0" om de Spam Beveiliging uit te zetten ) $cfg['text'] = TRUE; // Bij Fout Text Rood maken ( TRUE voor aan, FALSE voor uit ) $cfg['input'] = TRUE; // Bij Fout Border om Vakje Rood maken ( TRUE voor aan, FALSE voor uit ) $cfg['HTML'] = TRUE; // Een HTML email ( TRUE voor aan, FALSE voor uit ) $cfg['CAPTCHA'] = FALSE; // CAPTCHA ( TRUE voor aan, FALSE voor uit ) // Hieronder niks meer veranderen // E-mail Checker / Validator function checkmail($email) { if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$", $email)) { return TRUE; } return FALSE; } $formulier = TRUE; if(!isset($_COOKIE['formulier'])) { if(isset($_POST['wis']) && ($_SERVER['REQUEST_METHOD'] == "POST")) { foreach($_POST as $key => $value) { unset($value); } header("Location: ".$_SERVER['PHP_SELF'].""); } if(isset($_POST['verzenden']) && ($_SERVER['REQUEST_METHOD'] == "POST")) { $aFout = array(); $naam = trim($_POST['naam']); $email = trim($_POST['email']); $onderwerp = trim($_POST['onderwerp']); $bericht = trim($_POST['bericht']); if($cfg['CAPTCHA']) { $code = $_POST['code']; } if(empty($naam) || (strlen($naam) < 3) || eregi("[<>]", $naam) ) { $aFout[] = "Er is geen naam ingevuld."; unset($naam); $fout['text']['naam'] = TRUE; $fout['input']['naam'] = TRUE; } if(empty($email)) { $aFout[] = "Er is geen e-mail adres ingevuld."; unset($email); $fout['text']['email'] = TRUE; $fout['input']['email'] = TRUE; } elseif(checkmail($email) == 0) // Wanneer je PHP 5.2 > gebruikt //elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $aFout[] = "Er is geen correct e-mail adres ingevuld."; unset($email); $fout['text']['email'] = TRUE; $fout['input']['email'] = TRUE; } if(empty($onderwerp)) { $aFout[] = "Er is geen onderwerp ingevuld."; unset($onderwerp); $fout['text']['onderwerp'] = TRUE; $fout['input']['onderwerp'] = TRUE; } if(empty($bericht)) { $aFout[] = "Er is geen bericht ingevuld."; unset($bericht); $fout['text']['bericht'] = TRUE; $fout['input']['bericht'] = TRUE; } if($cfg['CAPTCHA']) { if(strtoupper($code) != $_SESSION['captcha_code']) { $aFout[] = "Er is geen correcte code ingevuld."; $fout['text']['code'] = TRUE; $fout['input']['code'] = TRUE; } } if(!$cfg['text']) { unset($fout['text']); } if(!$cfg['input']) { unset($fout['input']); } if(!empty( $aFout )) { $errors = ' <div id="errors"> <ul>'; foreach($aFout as $sFout) { $errors .= " <li>".$sFout."</li>\n"; } $errors .= "</ul> </div>"; } else { $formulier = FALSE; if($cfg['HTML']) { // Headers $headers = "From: \"Contact Formulier\" <".$cfg['email'].">\r\n"; $headers .= "Reply-To: \"".$naam."\" <".$email.">\n"; $headers .= "Return-Path: Mail-Error <".$cfg['email'].">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $bericht = ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> </head> <body> <br /> <b>Naam:</b> '.$naam.'<br /> <b>Email:</b> <a href=\"mailto:'.$email.'\">'.$email.'</a><br /> <br /> <b>Bericht:</b><br /> '.$bericht.' <br /> <br /> <br /> --------------------------------------------------------------------------<br /> <b>Datum:</b> '.date("d-m-Y @ H:i:s").'<br /> <b>IP:</b> <a href=\"http://sunny.nic.com/cgi-bin/whois?domain='.$_SERVER['REMOTE_ADDR'].'\">'.$_SERVER['REMOTE_ADDR'].'</a><br /> <b>Host:</b> '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'<br /> </body> </html>'; } else { $bericht_wrap = wordwrap ($bericht, 40, "\n", 1); // Headers $headers = "From: \"Contact Formulier\" <".$cfg['email'].">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset='iso-8859-1'\n"; // Bericht $message = "Naam: ".$naam." \n"; $message .= "E-mail: ".$email." \n"; $message .= "Bericht:\n".$bericht_wrap." \n "; $message .= " \n "; $message .= "Datum: ".date("d-m-Y H:i:s")." \n"; $message .= "------------------------------------------------------- \n "; $message .= "IP: ".$_SERVER['REMOTE_ADDR']." \n "; $message .= "Host: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." \n "; } function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) { //SMTP + SERVER DETAILS /* * * * CONFIGURATION START * * * */ $smtpServer = "mail.jouwdomein.nl"; $port = "25"; $timeout = "30"; $username = "webmaster@jouwdomein.nl"; $password = "geheim"; $localhost = "localhost"; $newLine = "\r\n"; /* * * * CONFIGURATION END * * * * */ //Connect to the host on the specified port $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout); $smtpResponse = fgets($smtpConnect, 515); if(empty($smtpConnect)) { $output = "Failed to connect: $smtpResponse"; return $output; } else { $logArray['connection'] = "Connected: $smtpResponse"; } //Request Auth Login fputs($smtpConnect,"AUTH LOGIN" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authrequest'] = "$smtpResponse"; //Send username fputs($smtpConnect, base64_encode($username) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authusername'] = "$smtpResponse"; //Send password fputs($smtpConnect, base64_encode($password) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authpassword'] = "$smtpResponse"; //Say Hello to SMTP fputs($smtpConnect, "HELO $localhost" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['heloresponse'] = "$smtpResponse"; //Email From fputs($smtpConnect, "MAIL FROM: $from" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailfromresponse'] = "$smtpResponse"; //Email To fputs($smtpConnect, "RCPT TO: $to" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailtoresponse'] = "$smtpResponse"; //The Email fputs($smtpConnect, "DATA" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['data1response'] = "$smtpResponse"; //Construct Headers $headers = "Content-type: text/plain".$newLine; //$headers = "MIME-Version: 1.0" . $newLine; //$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "To: $nameto <$to>" . $newLine; $headers .= "From: $namefrom <$from>" . $newLine; //fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n"); unix fputs($smtpConnect, "To: $to".$newLine."From: $from".$newLine."Subject: $subject".$newLine."$headers".$newLine.$newLine."$message".$newLine.".".$newLine); // windows $smtpResponse = fgets($smtpConnect, 515); $logArray['data2response'] = "$smtpResponse"; // Say Bye to SMTP fputs($smtpConnect,"QUIT" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['quitresponse'] = "$smtpResponse"; return TRUE; //print_r($logArray); } if(mail($cfg['email'], "[Contact] ".$onderwerp, $bericht, $headers)) { if(isset($_POST['stuurkopie'])) { $headers = "From: \"Contact Formulier\" <".$email.">\r\n"; $headers .= "Reply-To: \"".$naam."\" <".$email.">\n"; $headers .= "Return-Path: Mail-Error <".$email.">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; mail($email, "[Contact] ".$onderwerp, $bericht, $headers); } unset($naam, $email, $onderwerp, $bericht); setcookie("formulier", 1, time() + ( $cfg['spam'] * 60 ) ); echo " <p> Uw bericht is succesvol verzonden, er word zo snel mogelijk gereageerd.<br /> <br /> Met vriendelijke groeten,<br /> <b>".$cfg['naam']."</b> </p> "; } else { echo "Er is een fout opgetreden bij het verzenden van de email"; } header("refresh:3;url=".$cfg['url'].""); } } if($formulier) { ?> <!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"> <head> <title>Elevado-design.nl - Kleuren is geen kunst, kleuren combineren wel.</title> <link href="css/elevado_design.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="nl" /> </head> <body> <div class="top"></div> <div class="main"> <div class="logo"></div> <div class="menu_bg"> <?php include ("menu.php"); ?> <?php include ("nieuws.php"); ?> <h1>Contact</h1> Hieronder zijn de gegevens te vinden om in contact te komen met mij. Om direct een e-mail te sturen kunt u het formulier hieronder invullen of een e-mail sturen naar <a href="mailto:info@elevado-design.nl">info@elevado-design.nl</a><br/> <br/> Elevado Design<br/> Hoofdstraat 49a<br/> 8401 BW Gorredijk<br/> Mob: 06 285 104 82<br/> Mail: info@elevado-design.nl<br/> W: www.elevado-design.nl <div id="container"> <h3>Contact formulier</h3> <p>Velden met een * zijn verplicht.</p> <?php if(isset($errors)) { echo $errors; } ?> <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <p> <label <?php if(isset($fout['text']['naam'])) { echo 'class="fout"'; } ?>>Naam*:</label> <input name="naam" type="text" id="naam" value="<?php if (!empty($naam)) { echo stripslashes($naam); } ?>" size="35" maxlength="30" <?php if(isset($fout['input']['naam'])) { echo 'class="fout"'; } ?> /> <br /> <label <?php if(isset($fout['text']['email'])) { echo 'class="fout"'; } ?>>Email*:</label> <input name="email" type="text" id="email" value="<?php if (!empty($email)) { echo stripslashes($email); } ?>" size="35" maxlength="255" <?php if(isset($fout['input']['email'])) { echo 'class="fout"'; } ?> /> <br /> <label <?php if(isset($fout['text']['onderwerp'])) { echo 'class="fout"'; } ?>>Onderwerp*:</label> <input name="onderwerp" type="text" id="onderwerp" value="<?php if (!empty($onderwerp)) { echo stripslashes($onderwerp); } ?>" size="35" maxlength="40" <?php if(isset($fout['input']['onderwerp'])) { echo 'class="fout'; } ?> /> <br /> <label <?php if(isset($fout['text']['bericht'])) { echo 'class="fout"'; } ?>>Bericht*:</label> <textarea id="bericht" name="bericht" <?php if(isset($fout['input']['bericht'])) { echo 'class="fout"'; } ?> cols="38" rows="10"><?php if (!empty($bericht)) { echo stripslashes($bericht); } ?> </textarea> <br /> <?php if($cfg['CAPTCHA']) { ?> <label></label> <img src="captcha.php" alt="" /><br /> <label <?php if(isset($fout['text']['code'])) { echo 'class="fout"'; } ?>>Code:</label> <input type="text" id="code" name="code" maxlength="4" size="4" <?php if(isset($fout['input']['code'])) { echo 'class="captcha fout"'; } ?> /><br /> <?php } ?> <label for="stuurkopie">Stuur mij een kopie</label><input type="checkbox" id="stuurkopie" name="stuurkopie" value="1" /><br /> <label></label> <input type="submit" id="verzenden" name="verzenden" value="verzenden" /> </p> </form> </div> <?php include ("footer.php"); ?> <?php } } else { echo " <p> U kunt maar eens in de ".$cfg['spam']." minuten een e-mail versturen!<br /> U wordt nu automatisch doorgestuurd. </p>"; header("refresh:3;url=".$cfg['url'].""); } ?> nah.. i'm using it wrong I think... or not? Quote Link to comment https://forums.phpfreaks.com/topic/137344-contact-page-not-working/#findComment-717621 Share on other sites More sharing options...
Elevado Posted December 17, 2008 Author Share Posted December 17, 2008 Let me correct myself, it was not correct at all.. Could you please show me how it should be? or is that asked too much? It doesn't make sense to me yet.. Quote Link to comment https://forums.phpfreaks.com/topic/137344-contact-page-not-working/#findComment-717628 Share on other sites More sharing options...
JonnoTheDev Posted December 17, 2008 Share Posted December 17, 2008 No, no, no You are calling the function, not inserting the entire function into your script. Functions get used in the following manor: function xyz() { print "Hello"; } // function call - will print Hello xyz(); Firt you need to save the function code int a file, lets say email-functions.php. You then include that file into your contact page file: include('email-functions.php'); Now wherever the standard PHP mail() function is called, and it is used more than once in your script you need to replace with the new function. So instead of mail($email, "[Contact] ".$onderwerp, $bericht, $headers); you would use authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) Now the function parameters that your authSendEmail() function uses are different to the php mail() function so you must make sure the correct data goes into the function. i.e authSendEmail("from@somebody.com", "Joe Bloggs", "to@somebody.com", "Jim Smith", "Email subject", "Email message") If you are new to php then I would recommend reading up on functions as a noob may struggle modifying a script like the one you have posted Quote Link to comment https://forums.phpfreaks.com/topic/137344-contact-page-not-working/#findComment-717634 Share on other sites More sharing options...
Elevado Posted December 17, 2008 Author Share Posted December 17, 2008 Thanks for the fast replies.. I think I have to study some more PHP to understand everything... I have been looking for an other script... and finally got my contact page working... again thanks for the fast reactions!! Great! Quote Link to comment https://forums.phpfreaks.com/topic/137344-contact-page-not-working/#findComment-717742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.