PDA

View Full Version : Transforming old php mail script for a php-noob



goeiste
March 31st, 2008, 02:32 PM
Hello all,

I have used this php script in the past to be able to mail from a flash file. The main advantage from this form is that it has multiple entry boxes, and that the mail is well structured. I'm really a noob when it comes to php, and I'm confronted with a problem. This script seems to be written in an old version of php, and it doenst function on the server my website is on. i tried to use different scripts that I found on the internet, but they are not as good as this one (e.g only three comment fields, in stead of the multiple i have right now). Thus can anybody help me in transforming this script into a working php 4 or 5 script?

The script I used is as follows (I've already added php after the <?):


<?php
//pas de onderstaande variabelen aan naar jouw wensen
$adminaddress = "bashennephof@gmail.com";
//$siteaddress ="http://www.jouwwebsite.nl";
$sitename = "jouwwebsitenaam";
//hieronder hoeft in principe niets ge-edit te worden...

// Haalt de tijd en de datum van de server
$date = date("m/d/Y H:i:s");

// Haalt de informatie dat gepost is door Flash
$action = $HTTP_POST_VARS['action'] ;
$woonplaats = $HTTP_POST_VARS['woonplaats'] ;
$naam = $HTTP_POST_VARS['naam'] ;
$adres = $HTTP_POST_VARS['adres'] ;
$postcode = $HTTP_POST_VARS['postcode'] ;
$telefoon = $HTTP_POST_VARS['telefoon'] ;
$comments = $HTTP_POST_VARS['comments'] ;
//De informatie uit de tekstbalken (de variabelen) wordt gestructureerd naar jouw email adres gestuurd.
if ($action == "send") {
//hieronder kan de tekst worden aangepast
//een harde enter wordt weergegeven als /n
//alles na een $-teken is een variabele
mail ("$adminaddress","Info Request",
"Een bezoeker van $sitename heeft het volgende bericht achtergelaten\n
Voornaam: $Naam
Adres: $adres
Woonplaats: $woonplaats
Postcode: $postcode
Telefoon: $telefoon\n
Bericht van $naam:
______________________________

$comments


______________________________
Date/Time: $date","FROM:$adminaddress" ) ;


}
?>

kdd
March 31st, 2008, 02:57 PM
Too many mail() related problems these days. Hmmm. :shifty:

Anyways, what doesn't work? Here's the function you want to look at: http://us2.php.net/manual/en/function.mail.php