Ciao a tutti,![]()
ho scaricato dagli script (html.it) pronti questo semplice script per inviare un'email dirattamente dal browser:
__________________________________________________ _______________
<?
// MAILITE ~ php form processor
// Will process the contents of any html form (if you follow the instructions!)
// Provided By <ferret_at_nastyferret.com>
// DEFAULT SETTINGS
$owner_url = "www.yourname.co.uk"; // Your website address (no http://)
$site_name = "Your Site Name"; // The name of your site
$owner_email = "you@yourname.co.uk"; // Where results are sent
$email_subject = "Form Results"; // The subject of the results email
$success_title = "Successful Submission"; // Success page title
$success_msg = "Thank you for completing our form"; // Message printed upon success
$receipt_subject = "Thank You!"; // Email receipt subject
$receipt_body = "Hi
Thank you for completing our form, we'll
get back to you as soon as we can"; // Receipt email body
$logging = "Y"; // "Y" Adds user details (ip, browser etc) set to "N" if you wish to turn this off
// STYLE SETTINGS
$bgcolor = "#ffffff"; // Page background colour
$font = "verdana"; // Font face
$title_main_colour = "#000000"; // Main Title Colour
$main_colour = "#000000"; // Hex value of font main color
$size = "2"; // Main font size
$title_error_colour = "#ff0000"; // Colour of error title
$error_colour = "#ff0000"; // Colour of error message
// ERROR CHECKING
$error_title = "Error!"; // Error page title
$error_msg = "You missed a required field (click 'back')"; // Error message
// REQUIRED FIELDS
$check = array("owner_email"); // Consult 'README' before ammending
// SPAM LOCK
$spam_lock = "Y"; // Turn off at your own risk by changing to $spam_lock = "";
// EDIT PAST THIS POINT AT YOUR OWN RISK!!
if ($spam_lock) {
if (!$PHPSESSID) {
session_start();
}
else {
echo "<html>
<head>
<title></title>
</head>
<body bgcolor=$bgcolor>
<center><h2><font face=$font color=$title_main_colour>Error!</h2>
<font face=$font size=$size color=$main_colour>To protect our network from spam you are only allowed to submit this form once during a visit.
Return to <a href=\"http://$owner_url\">$site_name</a></font>
</center>
</body>
</html>";
exit;
}
}
else {
}
?>
<html>
<head>
<title></title>
</head>
<body bgcolor=<?echo "$bgcolor"; ?>>
<?
$count_array = 0;
do {
$r = $check[$count_array];
if(!$$r) {
echo "<center><h2><font face=$font color=$title_error_colour>$error_title</h2>";
echo "<font face=$font size=$size color=$error_colour>$error_msg</font></center>";
exit;
}
$count_array++;
} while ($count_array != count($check));
$date = date("m/d/Y H:i:s");
$traceroute = "<a href=\"http://www.above.net/cgi-bin/trace?$REMOTE_ADDR\">";
if ($REMOTE_ADDR == "") $ip = " no ip ";
else $ip = getHostByAddr($REMOTE_ADDR);
while(list($key, $val) = each($HTTP_POST_VARS)){
$key = stripslashes($key);
$val = stripslashes($val);
$body .= "$key: $val\n";
}
mail($email,$receipt_subject,$receipt_body,"From:$ owner_email");
if ($logging == "N") {
mail($owner_email,$email_subject,$body,"From:$owne r_email");
}
else if ($logging == "Y") {
$body .= "\n\nUsing: $HTTP_USER_AGENT";
$body .= "\nHostname: $ip";
$body .= "\nIP address: $REMOTE_ADDR";
$body .= "\nDate/Time: $date";
mail($owner_email,$email_subject,$body,"From:$owne r_email");
}
?>
<center>
<h2><font face=<? echo "$font"; ?> color=<? echo "$title_main_colour"; ?>><? echo "$success_title"; ?></h2>
<font face=<? echo "$font"; ?> size=<? echo "$size"; ?> color=<? echo "$main_colour"; ?>><? echo "$success_msg"; ?></font>
<font face=<? echo "$font"; ?> size=<? echo "$size"; ?> color=<? echo "$main_colour"; ?>>Return to "><? echo "$site_name"; ?></font>
</center>
</body>
</html>
__________________________________________________ ________________
devo attivare la funzione che quando spedisco la form e compilo il campo email, automaticamente mi deve arrivare un'email di conferma, ma questo non succede.
Vi posto anche il file readme, che sembra abbastanza chiaro, però non riesco a farlo funzionare.
__________________________________________________ ____________________
README
MAILITE ~ php form processor
-------------------------------------------
1. Overview
2. Setting Up
3. Uploading
4. Testing
5. Additional Configurations
IMPORTANT NOTE:
SPAM LOCK is enabled by default, I would advise turning it off for testing - BUT
BE SURE TO TURN IT ON WHEN YOUR FORM GOES LIVE (see top section of script)
1. Overview
------------------
MAILITE is a generic php form processor intended to format and send
the results of any form to the form owner via email. If you like it and use it,
if you don't - don't!
2. Setting Up
---------------------
Getting MAILITE running in itself is very simple, you should have your
html form ready.
a] Set the form action statement in your html form, you need to replace
existing statement with the following:
<form action="mailite.php" method="POST">
If you would like your visitor to receive a receipt email upon submitting the
form add the following field to your html form:
Email:<input type=text name=email value="">
Once set you need to save the changes
b] You now need to set the DEFAULT SETTINGS, these must be set
in order for the script to function. Open 'mailite.php' with your
favourite text editor (if on Windows, 'Notepad' will do). Look
for the DEFAULT SETTINGS heading towards the top of the
file and edit the settings for your site/email. The options are
annotated and very straight forward.
Once done save the changes to 'mailite.php'
3. Uploading
-------------------
You now need to upload your html form and the 'mailite.php' file to
your webspace. You should try and make sure that the
mailite.php file is uploaded in ASCII (plain text) format.
If you used the form action shown above, the files should
be uploaded to the same folder.
4. Testing
---------------
Ok, assuming you followed the instructions correctly you should
be able to visit your form in a browser. Try submitting it!
5. Additional Configuration options
--------------------------------------------------
Well, MAILITE does a few more things not mentioned above! We thought
that getting you up and running was the most important part.
a] MAILITE contains built in colour and font settings, you can set this to
the style of your website. Simply open 'mailite.php' in a text
editor and look for STYLE SETTINGS near the top of the file.
Change the values to suit your site, then save and upload.
MAILITE contains the facility to set 'required fields' in your
form. This slightly more comlicated to configure, but is by
no means rocket science!
First decide which fields in your form should be required, then
write the names of them down EXACTLY as they appear in your
html eg; I have a form with email, telephone and name fields that
I want to make required. So I look at the html form source code;
<input type="text" name="Email" value="">
<input type="text" name="Tel" value="">
<input type="text" name="Name" value="">
So, I wrote down: Email Tel and Name, NOT email tel and name!
Next, open 'mailite.php' in a text editor and look for the part titled
REQUIRED FIELDS. You will notice a line of code like this;
$check = array("owner_email");
You need to add your required fields in here, pay particular care
and attention! My example to make the Email Tel and Name fields
of my form required would look like this:
$check = array("Email","Tel","Name");
Notice the format? The fields are case sensitive, surrounded
by " double quotes and seperated by , commas. Once you
have entered yours, save the file and try it out.
NOTE: "owner_email" must stay here if you are not setting
any required fields, otherwise it can be removed.
B] ERROR MESSAGES can also be set these are straight forward, be
aware that they are only necessary if you have utilised the
REQUIRED FIELDS settings.
C] SPAM LOCK This is enabled by default turn it off at your own risk (see source code)
__________________________________________________ __________________
Se qualcuno può darmi una mano............![]()
P.s. tutto il resto funziona con tutti i campi che inserisco