Re: Newbie question about sending email

From: Date: Thu, 17 Apr 2008 16:17:06 +0000
Subject: Re: Newbie question about sending email
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-273191@lists.php.net to get a copy of this message
Daniel Brown has written on 4/16/2008 5:20 PM:
On Wed, Apr 16, 2008 at 5:14 PM, Pete Holsberg <pjh42@pobox.com> 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@yahoogroups.com,pjh42@pobox.com"; $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.

« previous php.general (#273191) next »