D&C GLug - Home Page

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

Re: [LUG] PHP e-mail

 

Hey,

Thanks - going to have to leave this till morning now but I'll take a
look at this first thing :D

Thanks again!

Jon

On 18/09/2007, Ryan Carson <ryan@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
>
>
> Ahhh, try this one on for size then
>
>
>
>
>
>
>
>
>  <?php
>
> $name                   =
> stripslashes(strip_tags($_POST['name']));
>
> $email                  =
> stripslashes(strip_tags($_POST['email']));
>
> $comments         = "Ohh look! A she-mail!"           //replace with nice
> post input :)
>
> $time             = date("YmdHi");
>
> $ip               = $_SERVER['REMOTE_ADDR'];
>
>
>
> $your_server            = "servername";         // (assumes .co.uk :))
>
> $youremail        = ""              // enter your email address in here
>
>
>
> $boundary = md5(uniqid(time()));    // Generate a unique boundary header
>
>
>
>
>
>
>
> // CONSTRUCT THE EMAIL VIA HEADERS (THIS WAY WE CAN SEND OUT MAIL VIA HTML
> AND TEXT)
>
>
>
>       $from = "contactform@".$your_server.".co.uk";
>
>       $fname = "Contact Form";
>
>       $femail = $youremail;
>
>
>
>       $subject = "Contact form Message Placed at - ".date("r");
>
>
>
>       $body_plain = "";
>
>       $body_plain.="Below are the details entered via your web form\n";
>
>       $body_plain.="Contacts Name: ".$name."\n\n";
>
>       $body_plain.="Contacts E-mail: ".$email."\n\n";
>
>       $body_plain.="Comments: ".$comments."\n\n";
>
>
>
>
>
>
>
>       $body_html = nl2br($body_plain);
>
>
>
>       $headers  = 'From: ' . $from . "\n";
>
>       $headers .= 'To: ' . $fname . " <".$femail.">" . "\n";
>
>       $headers .= 'Return-Path: ' . $from . "\n";
>
>       $headers .= 'MIME-Version: 1.0' ."\n";
>
>       $headers .= 'Content-Type: multipart/alternative; boundary="' .
> $boundary . '"' . "\n\n";
>
>       $headers .= $body_plain . "\n";
>
>       $headers .= '--' . $boundary . "\n";
>
>       $headers .= 'Content-Type: text/plain; charset=ISO-8859-1' ."\n";
>
>       $headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";
>
>       $headers .= $body_plain . "\n";
>
>       $headers .= '--' . $boundary . "\n";
>
>       $headers .= 'Content-Type: text/html; charset=ISO-8859-1' ."\n";
>
>       $headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";
>
>       $headers .= $body_html . "\n";
>
>       $headers .= '--' . $boundary . "--\n";
>
>
>
>
>
> //SHIP IT OFF :)
>
>
>
>       mail('', $subject,'', $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:39
>  To: list@xxxxxxxxxxxxx
>  Subject: Re: [LUG] PHP e-mail
>
>
>
>
> This line gives a syntax error :
>
> > $message = "$name.'\n'.$email";
>
>
>
> Thanks for the help though :D
>
>
>
> 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
>
>

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