Re: [PHP] Newbie question about sending email

2008-04-17 Thread Pete Holsberg

Daniel Brown has written on 4/16/2008 5:20 PM:

On Wed, Apr 16, 2008 at 5:14 PM, Pete Holsberg [EMAIL PROTECTED] 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(pMessage successfully sent!/p);
} else {
 echo(pMessage delivery failed.../p);
}

$to = [EMAIL PROTECTED],[EMAIL PROTECTED];
$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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Daniel Brown
On Thu, Apr 17, 2008 at 12:17 PM, Pete Holsberg [EMAIL PROTECTED] wrote:
[snip!]

  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(pMessage successfully sent!/p);
  } else {
   echo(pMessage delivery failed.../p);

  }
[snip!]

I'll reiterate:
   Note the mail() parameters.  There's no header information there.
RTFM: http://php.net/mail

You just have your mail() function wrong.  Reiterating my code as
well (with updated field_4 data):

?php

$where_form_is =
http://.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])./;
$to = [EMAIL PROTECTED],[EMAIL PROTECTED];
$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['field_4'].\r\n;
$headers .= X-Mailer: PHP/.phpversion().\r\n;

include(confirm.html);

?


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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Pete Holsberg

Daniel Brown has written on 4/17/2008 12:29 PM:

I'll reiterate:
   Note the mail() parameters.  There's no header information there.
RTFM: http://php.net/mail

You just have your mail() function wrong.  Reiterating my code as
well (with updated field_4 data):

?php

$where_form_is =
http://.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])./;
$to = [EMAIL PROTECTED],[EMAIL PROTECTED];
$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['field_4'].\r\n;
$headers .= X-Mailer: PHP/.phpversion().\r\n;

include(confirm.html);

?


OK. I don't see a mail() in your code. Would it be

mail($to, $subject, $body, $headers);

?

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Daniel Brown
On Thu, Apr 17, 2008 at 12:37 PM, Pete Holsberg [EMAIL PROTECTED] wrote:

  OK. I don't see a mail() in your code. Would it be

  mail($to, $subject, $body, $headers);

  ?

Entirely my fault, Pete.  I'm a moron sometimes.  Could've sworn
it was in there.  Sorry about that.

Yes, you've got it exactly right.

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Pete Holsberg

Ooops!

processor.php is now:


?php

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


$to = [EMAIL PROTECTED],[EMAIL PROTECTED];
$subject = SUBSCRIBE;
//$from = $_POST['field_4'];  == this was the culprit
$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['field_4'].\r\n;
$headers .= X-Mailer: PHP/.phpversion().\r\n;

mail($to, $from, $subject, $body);

include(confirm.html);
?

AND IT WORKS!!

1E6 thank yous!!

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Daniel Brown
On Thu, Apr 17, 2008 at 12:50 PM, Pete Holsberg [EMAIL PROTECTED] wrote:

  1E6 thank yous!!

My TI SR-10 couldn't handle that calculation and blew up in my hand.  ;-P

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Daniel Brown
On Wed, Apr 16, 2008 at 3:53 PM, Pete Holsberg [EMAIL PROTECTED] wrote:
 I wanted a form for people in my community to use to subscribe to a yahoo
 group that I run.

  Not being a PHP programmer, I created the form with phpFormGenerator from
 SourceForge.

  It works fine except that the email that gets sent to yahoo appears to come
 from my web host's domain!

  How can I change things so that the email appears to come from the email
 address that is entered in the form?

Make sure that the From:, Reply-To:, and Return-Path: headers are
correctly set in the form processing code, that the headers in general
are properly constructed, and that your host allows aliased sending by
configuration (some MTA configurations only allow a single address, to
reduce SPAM and such).

-- 
/Daniel P. Brown
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Pete Holsberg

Daniel Brown has written on 4/16/2008 4:04 PM:

On Wed, Apr 16, 2008 at 3:53 PM, Pete Holsberg [EMAIL PROTECTED] wrote:
  

I wanted a form for people in my community to use to subscribe to a yahoo
group that I run.

 Not being a PHP programmer, I created the form with phpFormGenerator from
SourceForge.

 It works fine except that the email that gets sent to yahoo appears to come
from my web host's domain!

 How can I change things so that the email appears to come from the email
address that is entered in the form?



Make sure that the From:, Reply-To:, and Return-Path: headers are
correctly set in the form processing code, that the headers in general
are properly constructed, and that your host allows aliased sending by
configuration (some MTA configurations only allow a single address, to
reduce SPAM and such).


The entire processor.php file is:

?php

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

mail([EMAIL PROTECTED],[EMAIL PROTECTED],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);

?

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Daniel Brown
On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg [EMAIL PROTECTED] wrote:

  The entire processor.php file is:

  ?php


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

  mail([EMAIL PROTECTED],[EMAIL PROTECTED],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 = [EMAIL PROTECTED],[EMAIL PROTECTED];
$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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Pete Holsberg

Daniel Brown has written on 4/16/2008 4:56 PM:

On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg [EMAIL PROTECTED] wrote:
  

 The entire processor.php file is:

 ?php


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

 mail([EMAIL PROTECTED],[EMAIL PROTECTED],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 = [EMAIL PROTECTED],[EMAIL PROTECTED];
$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'].
  



Why do I need both from_addr and field_4 (Email Address)? Could I just use

$from = $_POST['field_4']?

Thanks.


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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Daniel Brown
On Wed, Apr 16, 2008 at 5:14 PM, Pete Holsberg [EMAIL PROTECTED] 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.

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