Re: Newbie question about sending email

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

 



Daniel Brown has written on 4/16/2008 5:20 PM:
On Wed, Apr 16, 2008 at 5:14 PM, Pete Holsberg <pjh42@xxxxxxxxx> wrote:
 Why do I need both from_addr and field_4 (Email Address)? Could I just use

 $from = $_POST['field_4']?

    Sorry, I noticed it after I started rewriting the form processor,
and then forgot to edit the email accordingly.

    That's correct.  Where I placed the $_POST['from_addr'] stuff,
just replace it with $_POST['field_4'].  And then, of course, you can
ignore the HTML field-adding section of my previous email

OK. Here's what I have now for processor.php:

<?php

// $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

$where_form_is = "http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";

if (mail($to, $from, $subject, $body)) {
 echo("<p>Message successfully sent!</p>");
} else {
 echo("<p>Message delivery failed...</p>");
}

$to = "4sam-nj-subscribe@xxxxxxxxxxxxxxx,pjh42@xxxxxxxxx";
$subject = "SUBSCRIBE";
$from = $_POST['field_4'];
$body = "Form data:

Name: ".$_POST['field_1']."
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");

?>

I don't get either of the echo statements, and the emails are not being delivered.

What did I omit?

Thanks.

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