Re: Newbie question about sending email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg <pjh42@xxxxxxxxx> wrote:
>
>  The entire processor.php file is:
>
>  <?php
>
>
> $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
>
>  mail("4sam-nj-subscribe@xxxxxxxxxxxxxxx,pjh42@xxxxxxxxx","SUBSCRIBE","Form
> data:
>
>  Name: " . $_POST['field_1'] . "
>  Street Address: " . $_POST['field_2'] . "
>  Phone Number: " . $_POST['field_3'] . "
>  Email Address: " . $_POST['field_4'] . "
>
>
>  powered by phpFormGenerator.
>  ");
>
>  include("confirm.html");
>
>  ?>

    Note the mail() parameters.  There's no header information there.

    In your HTML form, add the following field (dress up the HTML as
needed to fit with your form):

<input type="text" name="from_addr">

    Then, change the email processing code to the following:

<?php

$where_form_is =
"http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";
$to = "4sam-nj-subscribe@xxxxxxxxxxxxxxx,pjh42@xxxxxxxxx";
$subject = "SUBSCRIBE";
$from = $_POST['from_addr'];
$body = "Form data:

Name: ".$_POST['field_1']."
Email: ".$_POST['from_addr']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."

powered by phpFormGenerator, but fixed by PHP-General!";

$headers  = "From: \"".$_POST['field_1']."\" <".$_POST['from_addr'].">\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";

include("confirm.html");

?>

    Keep in mind, though, that there's no validation and no SPAM
protection there, but if you're letting Yahoo! manage the group, it's
not *quite* as big of a deal.  You may notice SPAM coming through to
the @pobox.com address from the form though.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux