D&C GLug - Home Page

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

Re: [LUG] PHP e-mail

 

Ahhh...you're sending to googlemail eh?

Some (MOST) mail providers have strong dislikes to automated php emails :)

Hotmail is infamous for this.

Although, really, there's lots of guides on t'internet to sort you through
sending all sorts of mail via php :)

Here's some basic bounds checking for you.

$name =
htmlentities(stripslashes($_POST['name']),ENT_QUOTES,'UTF-8');
$email =
htmlentities(stripslashes($_POST['email']),ENT_QUOTES,'UTF-8');



Not the most secure, you'll wawnt to  validate the email further with
regular expressions but I'm not giving out all my code :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 Tom Potts
Sent: 18 September 2007 19:30
To: list@xxxxxxxxxxxxx
Subject: Re: [LUG] PHP e-mail

On Tuesday 18 September 2007 19:14, Jonathan Roberts wrote:
> 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
just how doesnt it work?
Tom te tom te tom


-- 
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