Email

Status
Niet open voor verdere reacties.
Ik gebruik zelf ook een mailform in verband met gmail en bij mij komt het altijd in mn spamfolder terecht, maar het komt hier wel degelijk aan dus ik heb helaas geen idee wat er mis gaat bij jou :confused:

Ik denk dat je beter een heel ander script kan gebruiken ;)


kan je dat mailform hier miss posten?
 
Hier de scripts die ik heb gebruikt, ze zijn van mijn website afgehaald dus er staat soms iets in dat ik al heb aangepast.

formulier.php
PHP:
<form action="FormToEmail.php" method="post">
<table border="0" bgcolor="#ececec" cellspacing="5">
<tr><td>Name</td><td><input type="text" size="30" name="name"></td></tr>
<tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr>
<tr><td valign="top">Description & Links</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Send"></font></td></tr>
</table>
</form>

FormToEmail.php
PHP:
<?php

/*

Thank you for choosing FormToEmail by FormToEmail.com

Version 1.9 December 31st 2006

COPYRIGHT FormToEmail.com 2003 - 2006

You are not permitted to sell this script, but you can use it, copy it or distribute it, providing that you do not delete this copyright notice, and you do not remove any reference to FormToEmail.com


You can get the Pro version of this script here: http://formtoemail.com/formtoemail_pro_version.php
---------------------------------------------------------------------------------------------------

FormToEmail-Pro Features:

Check for required fields.
Show sender's IP address.
Block IP addresses.
Check for a set cookie.
Check comments for web addresses or rude words.
Check for gobbledegook characters (Å ð ç etc).
Auto redirect to "Thank You" page.
No branding.

---------------------------------------------------------------------------------------------------


FormToEmail DESCRIPTION

FormToEmail is a contact-form processing script written in PHP. It allows you to place a form on your website which your visitors can fill out and send to you.  The contents of the form are sent to the email address (or addresses) which you specify below.  The form allows your visitors to enter their name, email address and comments.  If they try to send a blank form, they will be returned to the form.

Your visitors (and nasty spambots!) cannot see your email address!  The script cannot be hijacked by spammers.

When the form is sent, your visitor will get a confirmation of this on the screen, and will be given a link to continue to your homepage, or other page if you specify it.

Should you need the facility, you can add additional fields to your form, which this script will also process without making any additional changes to the script.  You can also use it to process other forms.  The script will handle the "POST" or "GET" methods.  It will also handle multiple select inputs and multiple check box inputs.  If using these, you must name the field as an array using square brackets, like so: <select name="fruit[]" multiple>.  The same goes for check boxes if you are using more than one with the same name, like so: <input type="checkbox" name="fruit[]" value="apple">Apple<input type="checkbox" name="fruit[]" value="orange">Orange<input type="checkbox" name="fruit[]" value="banana">Banana

This is a PHP script.  In order for it to run, you must have PHP (version 4.1.0 or later) on your webhosting account, and have the PHP mail() function enabled.  If you are not sure about this, please ask your webhost about it.

SETUP INSTRUCTIONS

Step 1: Put the form on your webpage
Step 2: Enter your email address and continue link below
Step 3: Upload the files to your webspace

Step 1:

To put the form on your webpage, copy the code below as it is, and paste it into your webpage:

<form action="FormToEmail.php" method="post">
<table border="0" bgcolor="#ececec" cellspacing="5">
<tr><td>Name</td><td><input type="text" size="30" name="name"></td></tr>
<tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr>
<tr><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Send"><font face="arial" size="1">&nbsp;&nbsp;FormToEmail by <a href="http://FormToEmail.com">FormToEmail.com</a></font></td></tr>
</table>
</form>

Step 2:

Enter your email address.

Enter the email address below to send the contents of the form to.  You can enter more than one email address separated by commas, like so: $my_email = "bob@example.com,sales@example.co.uk,jane@example.com";

*/

$my_email = "HIERJOUEMAILADRES";

/*

Enter the continue link to offer the user after the form is sent.  If you do not change this, your visitor will be given a continue link to your homepage.

If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"

*/

$continue = "index.php";

/*

Step 3:

Save this file (FormToEmail.php) and upload it together with your webpage to your webspace.  IMPORTANT - The file name is case sensitive!  You must save it exactly as it is named above!  Do not put this script in your cgi-bin directory (folder) it may not work from there.

THAT'S IT, FINISHED!

You do not need to make any changes below this line.

*/

//  Initialise variables

$errors = array();

if($_SERVER['REQUEST_METHOD'] == "POST"){$form_input = $_POST;}elseif($_SERVER['REQUEST_METHOD'] == "GET"){$form_input = $_GET;}else{exit;}

// Remove leading whitespace from all values.

function recursive_array_check(&$element_value)
{

if(!is_array($element_value)){$element_value = ltrim($element_value);}
else
{

foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);}

}

return $element_value;

}

recursive_array_check($form_input);

// Check referrer is from same site.

if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

// Check for a blank form.

function recursive_array_check_blank($element_value)
{

global $set;

if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{

foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}

}

}

recursive_array_check_blank($form_input);

if(!$set){$errors[] = "You cannot send a blank form";}

// Strip HTML tags from all fields.

function recursive_array_check2(&$element_value)
{

if(!is_array($element_value)){$element_value = strip_tags($element_value);}
else
{

foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check2($value);}

}

return $element_value;

}

recursive_array_check2($form_input);

// Validate name field.

if(isset($form_input['name']) && !empty($form_input['name']))
{

if(preg_match("`[\r\n]`",$form_input['name'])){$errors[] = "You have submitted an invalid new line character";}

if(preg_match("/[^a-z' -]/i",stripslashes($form_input['name']))){$errors[] = "You have submitted an invalid character in the name field";}

}

// Validate email field.

if(isset($form_input['email']) && !empty($form_input['email']))
{

if(preg_match("`[\r\n]`",$form_input['email'])){$errors[] = "You have submitted an invalid new line character";}

if(!preg_match('/^([a-z][a-z0-9_.-\/\%]*@[^\s\"\)\?<>]+\.[a-z]{2,6})$/i',$form_input['email'])){$errors[] = "Email address is invalid";}

}

// Display any errors and exit if errors exist.

if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}

// Build message.

function build_message($request_input){if(!isset($message_output)){$message_output = "";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!is_numeric($key)){$message_output .= "\n\n".$key.": ".build_message($value);}else{$message_output .= "\n\n".build_message($value);}}}return $message_output;}

$message = build_message($form_input);

$message = $message . "\n\n-- \nGo to dimitri-korsakov.com";

$message = stripslashes($message);

$subject = "Submission dimitri-korsakov.com";

$headers = "From: " . $form_input['email'] . "\n" . "Return-Path: " . $form_input['email'] . "\n" . "Reply-To: " . $form_input['email'] . "\n";

mail($my_email,$subject,$message,$headers);

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<div>
<center>
<br><b>Thank you <?php print stripslashes($form_input['name']); ?></b>
<br>Your message has been sent
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>
<p><b>Thanks for submitting!</p>
</center>
</div>
 
Laatst bewerkt:
Bedankt maar dit werkt helaas ook niet...
Probeer dit eens:
[verwerkemail.php]ofzoiets
Code:
<?php  

//de instellingen:   

$Eigen_mail = "vbprojecten92@gmail.com";  
$Eigen_naam = "Thomas";  
$Onderwerp = "Reactie";
$browser = $HTTP_USER_AGENT;  
$ip = $_SERVER['REMOTE_ADDR'];


if($_REQUEST['verzend'])  
{  
    $naam = $_REQUEST['naam'];  
    $email = $_REQUEST['email'];  
    $opmerkingen = $_REQUEST['opmerkingen'];  


    // kijken of het een juist email adres is:  
    $error = false;  
    if ((!ereg(".+\@.+\..+", $email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $email))){  
    $error .= "ongeldig emailadres<br>";}  

    //als het een onjuist emailadres is:
    if($error)  
    {  
        echo $error;  
    }  
    else   
    {  
        //geen fouten:
        //Het bericht maken: 
        $boodschap = "Reactie <br />";  
        $boodschap .= "Naam: " . $naam . "<br />";  
        $boodschap .= "Emailadres: " . $email . "<br />";  
        $boodschap .= "Bericht: " . $opmerkingen . "<br />";  
        $boodschap .= "-----------------------------<br />";  
        //informatie die misschien handig kan zijn: 
        $boodschap .= "Web - Browser: " . $browser . "<br />";  
        $boodschap .= "IP - adres: " . $ip . "<br />";

        // maak de headers  
        $headers  = 'MIME-Version: 1.0' . "\r\n";  
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  
        $headers .= 'From: ' . $naam . ' <' . $email . '>' . "\r\n";  
        $headers .= 'Reply-To: ' . $naam . ' <' . $email . '>' . "\r\n";  
        
		//bericht om hieronder te echo'en
		
		$succes_bericht ="Je bericht is succesvol verzonden.\n";
		$succes_bericht .="Als je bericht is ontvangen zou er zo\n";
		$succes_bericht .="snel mogelijk gereageerd worden.\n";
	
		$send_bericht ="Hier uw verzonden bericht:\n";
		$send_bericht .="Van:"	.$naam."\n";
		$send_bericht .="Email:" .$email."\n";
		$send_bericht .="Headers:" .$headers."\n";
		$send_bericht .="Bericht:" .$boodschap."\n\n"; 
		
		$aan_onderwerp ="Aan:" . $Eigen_mail ."\n";
		$aan_onderwerp .="Onderwerp:" . $Onderwerp ."\n\n";
		
        // Verstuur het mailtje [je moet eerst email to, dan subject, boodschap, headers of email van verzender]: 
if 		(mail($Eigen_mail, $Onderwerp, $boodschap, $headers))
{
	echo  ("Automatisch gegenereerd bericht:" .$succes_bericht."Einde automatisch gegenereerd bericht.");
	?>
	<html>
	<br /><br />
	</html>
	<?php
	echo  ("Automatisch gegenereerd bericht:" .$aan_onderwerp."Einde automatisch gegenereerd bericht.");
	?>
	<html>
	<br /><br />
	</html>
	<?php
	echo 	("Automatisch gegenereerd bericht:" .$send_bericht."Einde automatisch gegenereerd bericht.");
}  
	  
else {
?>
<html>
<form method='post' action="emailhelpmij.php">
<tr>
  <td width='20%'>Naam:</td>
  <td><input type='text' name='naam' /></td>
</tr>
<tr>
	<td width='20%'>Email adress: </td>
	<td><input type='text' name='email' /></td>
</tr>
<tr>
  <td width='20%'>Bericht:</td>
  <td><input type='text' name='opmerkingen' rows="10" wrap="hard" /></td>
</tr>
<tr>
  <td colspan='2' align='center'><input type='submit' value='verzend' name='verzend' /></td>
  <td><input type='reset' value='reset'>
</tr>
</form>
</html>
<?php
	}
 }
 }
?>
[email.php]
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<meta name="author" content="PSResource">

	<title>Untitled 3</title>
</head>

<body>

<form method='post' action="verwerkemail.php">
<tr>
  <td width='20%'>Naam:</td>
  <td><input type='text' name='naam' /></td>
</tr>
<tr>
	<td width='20%'>Email adress: </td>
	<td><input type='text' name='email' /></td>
</tr>
<tr>
  <td width='20%'>Bericht:</td>
  <td><input type='text' name='opmerkingen' rows="10" wrap="hard" /></td>
</tr>
<tr>
  <td colspan='2' align='center'><input type='submit' value='verzend' name='verzend' /></td>
  <td><input type='reset' value='reset'>
</tr>
</form>

</body>
</html>

Dit werkt prima bij mij, alleen de browser detect functie werkt niet, maar dat moet je zelf maar fixen. Als hij nog niet werkt kijk dan of de mail functie op je server aanstaat.
 
Het kan ook zijn dat de mailserver geen mails van PHP mag versturen, meestal is de standaard header-from: www-data@domain.ext.
Maar als jij dat aanpast, en je kan geen mails verzenden via PHP, dan kan het zijn dat het niet mag van de server.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan