D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] PHP e-mail

 

Ahh yeah, as I said ,It's a lil rushed, getting my quotes all mixed up :)

You should be able to debug through it pretty imply though err hang on...

Kind regards as always.

  

Ryan Carson - Director

Refresh Creations Ltd

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

Web: http://www.refreshcreations.co.uk/

Tel: 0845 09 42 987

Fax: 0870 80 30 989


-----Original Message-----
From: list-bounces@xxxxxxxxxxxxx [mailto:list-bounces@xxxxxxxxxxxxx] On
Behalf Of Ryan Carson
Sent: 18 September 2007 19:38
To: list@xxxxxxxxxxxxx
Subject: Re: [LUG] PHP e-mail

One bonus way... just to slow the spammers is to use a captcha type password
system. You can do some awesome things with gdlib :D

Kind regards as always.

  

Ryan Carson - Director

Refresh Creations Ltd

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

Web: http://www.refreshcreations.co.uk/

Tel: 0845 09 42 987

Fax: 0870 80 30 989


-----Original Message-----
From: list-bounces@xxxxxxxxxxxxx [mailto:list-bounces@xxxxxxxxxxxxx] On
Behalf Of Ryan Carson
Sent: 18 September 2007 19:33
To: list@xxxxxxxxxxxxx
Subject: Re: [LUG] PHP e-mail

Very Quickly pearoasted:

<form action="send.php" method="post">
<p><label for="name">Name</label><input type="text" id="name" name="name"
/></p>

<p><label for="email">E-mail</label><input type="text" id="email"
name="email" /></p>

<p><input type="submit" name="submit" value="Submit Form" /></p>

</form>


<?

$name = $_POST['name'];
$email = $_POST['email'];

$to = "jonathan.roberts.uk@xxxxxxxxxxxxxx";
$toname="Jonathan Roberts";

$subject = "test"
$message = "$name.'\n'.$email";
$headers = "From: $email";
        $headers  = 'From: ' . $email . "\n";
        $headers .= 'To: ' . $toname . " <".$to.">" . "\n";
        mail($to,$subject,$message,$headers);

?>


Of course you'll be wanting to put some bounds checking in the form so
people don't enter corrupt data and thus mess up the headers :)

Kind regards as always.

  

Ryan Carson - Director

Refresh Creations Ltd

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

Web: http://www.refreshcreations.co.uk/

Tel: 0845 09 42 987

Fax: 0870 80 30 989

-----Original Message-----
From: list-bounces@xxxxxxxxxxxxx [mailto:list-bounces@xxxxxxxxxxxxx] On
Behalf Of Jonathan Roberts
Sent: 18 September 2007 19:14
To: LUG List
Subject: [LUG] PHP e-mail

Hi all,

I wonder if any one can give me a hand with a bit of PHP (again!). I'm
trying to write a small script that will e-mail the contents of a form
to me. The form looks like this (for now):

<form action="send.php" method="post">

<p>Name<input type="text" name="name" /></p>

<p>E-mail<input type="text" name="email" /></p>

<p><input type="submit" /></p>

</form>

And the PHP I think I need is this:

<?

$name = $_REQUEST['name'];
$email = $_REQUEST['email'];

$to = "jonathan.roberts.uk@xxxxxxxxxxxxxx";
$subject = "test"
$message = "$name.'\n'.$email";
$headers = "From: $email";

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

?>

Can any body spot anything wrong, because I can't seem to get this to
work how I imagine!!

Jon

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007
13:29
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007
13:29
 


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007
13:29
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007
13:29
 


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007
13:29
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007
13:29
 


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html