Zit te stoeien met dit script voor een mailformulier.
Alles werkt alleen alle invoervelden komen niet aan in mijn mail.
Alleen het invoerveld $messege = $tekst; komt aan in mijn mail.
dat is dus het veld waar ze vrij informatie kunnen typen, de rest zoals naam mailadres leeftijd etc etc dat bereikt me niet.
Zou iemand eens het script kunnen bekijken en em zeggen waar de fout zit? Heeft me al heel wat gekost om tot hier te komen en weet dat ik er nu bijna ben maar heb een laaste duwtje nodig.
Zal beide scripts posten, de eerste is de PHP en de tweede de HTML pagina.
Alles werkt alleen alle invoervelden komen niet aan in mijn mail.
Alleen het invoerveld $messege = $tekst; komt aan in mijn mail.
dat is dus het veld waar ze vrij informatie kunnen typen, de rest zoals naam mailadres leeftijd etc etc dat bereikt me niet.
Zou iemand eens het script kunnen bekijken en em zeggen waar de fout zit? Heeft me al heel wat gekost om tot hier te komen en weet dat ik er nu bijna ben maar heb een laaste duwtje nodig.
Zal beide scripts posten, de eerste is de PHP en de tweede de HTML pagina.
PHP:
********PHP******
<style type="text/css">
<!--
body {
background-color: #99CCFF;
}
-->
</style>
<?php
//new function
$to = "mijn_mail_adres";
$nameto = "paginaweb";
$from = "mijn_mail_adres";
$namefrom = "webpagina";
$subject = "desde pagina web";
$nombre = $naam; // dit verstuurt hij niet
$apollidos = $achternaam; // dit verstuurt hij niet
$edad = $leeftijd; // dit verstuurt hij niet
$telefono = $telefoon; // dit verstuurt hij niet
$correo_electronico = $mail; // dit verstuurt hij niet
$message = $tekst; // dit is het enige vak wat hij verstuurt!!!!!!!!!
authSendEmail($from, $namefrom, $to, $nameto, $subject, $nombre, $apollidos, $edad, $telefono, $correo_electronico, $message);
?>
<?php
/* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */
//Authenticate Send - 21st March 2005
//This will send an email using auth smtp and output a log array
//logArray - connection,
function authSendEmail($from, $namefrom, $to, $nameto, $subject, $nombre, $apollidos, $edad, $telefono, $correo_electronico, $message)
{
//SMTP + SERVER DETAILS
/* * * * CONFIGURATION START * * * */
$smtpServer = "mijn_smtp_adres";
$port = "25";
$timeout = "30";
$username = "mijn_mail_adres";
$password = "mijn_mail_wachtwoord";
$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 = "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");
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data2response'] = "$smtpResponse";
// Say Bye to SMTP
fputs($smtpConnect,"QUIT" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['quitresponse'] = "$smtpResponse";
}
?>
<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<p align="center"><strong>Gracias,</strong></p>
<p align="center"><strong>Su mail esta enviado.</strong></p>
<p align="center"><strong>En breve momento me pongo en contacto con Usted.</strong></p>
<p align="center"><strong>Claudia Perez </strong></p>
<p align="center"> </p>
<label>
<div align="center">
<input name="Button" type="button" onClick="MM_goToURL('parent','http://www.psicologamalaga.es');return document.MM_returnValue" value="pagina de inicio">
</div>
</label>
*****HTML******
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #99CCFF;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="testmail.php">
<label>
<div align="center"><br />
Por favor, <br />
si Usted deja sus datos aqui entonces me pongo en contacto<br />
Con Usted en breves momentos.
<br />
<br />
<br />
Nombre
<input name="Naam" type="text" id="Naam" size="40" />
<br />
<br />
Apollidos
<input name="achternaam" type="text" id="achternaam" size="50" />
<br />
<br />
Edad
<input name="leeftijd" type="text" id="leeftijd" size="5" />
<br />
<br />
Telefono
<input name="telefoon" type="text" id="telefoon" size="25" />
<br />
<br />
Correo electronico <strong>@</strong>
<input name="mail" type="text" id="mail" size="40" />
<br />
<br />
<br />
<br />
<textarea name="tekst" cols="50" rows="5" id="tekst">Escribe aqui sus comentarios....
</textarea>
</div></label>
<p>
<label>
<div align="center">
<input name="sturen" type="submit" id="sturen" value="versturen" />
</div>
</label>
</p>
</form>
</body>
</html>
Laatst bewerkt door een moderator: