[ciapug] Fw: Post variables
Mike Parks
parksmike at dwx.com
Sun Jan 15 11:03:10 CST 2006
Line edit on this
foreach($_REQUEST as $key=>$value){
# Values not added tot he body of the message
if($key == "PHPSESSID" || $key == "recipient" || $key == "subject"){
continue;
} else {
# Add to message body
$msg .= $key . ": " . $value . "\n";
}
}
/**
* Using the mail class that I have written
*/
$sndmsg = new Mail;
$sndmsg->ToMail = $_REQUEST['recipient];
$sndmsg->FromMail = $_REQUEST['email'];
$sndmsg->FromName = $_REQUEST['name'];
$sndmsg->Subject = $_REQUEST['subject'];
$sndmsg->Message = $msg;
$sndmsg->SendMessage();I left out the "\n".
This is the Mail class I use
<?php
class Mail{
function SendMessage(){
$Message = stripslashes($this->Message);
$headers .= "From: ".$this->FromName.
"<".$this->FromMail.">\n";
$headers .= "X-Rcpt-To: ".$this->FromMail. "\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: Low\n";
$headers .= "X-Mailer: PHP Mailer\n";
$headers .= "Origin: ". $_SERVER['REMOTE_ADDR']."\n";
mail($this->ToMail, $this->Subject, $Message, $headers) or die("Message
could not be sent");
}
}
?>
Mike
> ----- Original Message -----
> From: "Mike Parks" <parksmike at dwx.com>
> To: <ciapug at cialug.org>
> Sent: Sunday, January 15, 2006 10:32 AM
> Subject: Re: Post variables
>
>
>> Dave,
>> I've been writing email forms like that
>> I run a foreach like this
>>
>> foreach($_REQUEST as $key=>$value){
>> # Values not added tot he body of the message
>> if($key == "PHPSESSID" || $key == "recipient" || $key == "subject"){
>> continue;
>> } else {
>> # Add to message body
>> $msg .= $key . ": " . $value;
>> }
>> }
>>
>> /**
>> * Using the mail class that I have written
>> */
>> $sndmsg = new Mail;
>> $sndmsg->ToMail = $_REQUEST['recipient];
>> $sndmsg->FromMail = $_REQUEST['email'];
>> $sndmsg->FromName = $_REQUEST['name'];
>> $sndmsg->Subject = $_REQUEST['subject'];
>> $sndmsg->Message = $msg;
>> $sndmsg->SendMessage();
>>
>> Mike
>>
>>
>> ----- Original Message -----
>> From: <ciapug-request at cialug.org>
>> To: <ciapug at cialug.org>
>> Sent: Saturday, January 14, 2006 12:00 PM
>> Subject: ciapug Digest, Vol 9, Issue 5
>>
>>
>>> Send ciapug mailing list submissions to
>>> ciapug at cialug.org
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>> http://cialug.org/mailman/listinfo/ciapug
>>> or, via email, send a message with subject or body 'help' to
>>> ciapug-request at cialug.org
>>>
>>> You can reach the person managing the list at
>>> ciapug-owner at cialug.org
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of ciapug digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>> 1. Post variables (Dave J. Hala Jr.)
>>> 2. Re: Post variables (Tony Bibbs)
>>> 3. Re: Post variables (Dave J. Hala Jr.)
>>> 4. php5 (Scott Phillips)
>>> 5. Re: php5 (Tony Bibbs)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Fri, 13 Jan 2006 13:11:15 -0600
>>> From: "Dave J. Hala Jr." <dave at 58ghz.net>
>>> Subject: [ciapug] Post variables
>>> To: PHP List <ciapug at cialug.org>
>>> Message-ID: <1137179474.17709.196.camel at dsl-69.marshallnet.com>
>>> Content-Type: text/plain
>>>
>>> I'm looking for a way to take all the values posted from a form "pre
>>> format" them into an email. I'd then like to take that message and hand
>>> it off to PHP mailer.
>>>
>>> I remember a long time ago using some perl scripts that took whatever
>>> values were posted and then created a message and emailed it. Its was
>>> fairly painless. Has anyone seem anything like for php?
>>>
>>> :) Dave
>>>
>>> --
>>>
>>> Open Source Information Systems, Inc. (OSIS)
>>> Dave J. Hala Jr., President <dave at osis.us>
>>> 641.485.1606
>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Message: 2
>>> Date: Fri, 13 Jan 2006 13:18:40 -0600
>>> From: Tony Bibbs <tony at tonybibbs.com>
>>> Subject: Re: [ciapug] Post variables
>>> To: ciapug at cialug.org
>>> Message-ID: <43C7FD10.3040208 at tonybibbs.com>
>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>>
>>> You mean something like these?
>>>
>>> http://www.google.com/search?q=php%20form%20mail
>>>
>>> --Tony
>>>
>>> Dave J. Hala Jr. wrote:
>>>> I'm looking for a way to take all the values posted from a form "pre
>>>> format" them into an email. I'd then like to take that message and
>>>> hand
>>>> it off to PHP mailer.
>>>>
>>>> I remember a long time ago using some perl scripts that took whatever
>>>> values were posted and then created a message and emailed it. Its was
>>>> fairly painless. Has anyone seem anything like for php?
>>>>
>>>> :) Dave
>>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Message: 3
>>> Date: Fri, 13 Jan 2006 13:22:41 -0600
>>> From: "Dave J. Hala Jr." <dave at 58ghz.net>
>>> Subject: Re: [ciapug] Post variables
>>> To: PHP List <ciapug at cialug.org>
>>> Message-ID: <1137180161.17709.199.camel at dsl-69.marshallnet.com>
>>> Content-Type: text/plain
>>>
>>> Thanks. I was just in the process of Googling it myself.
>>>
>>> On Fri, 2006-01-13 at 13:18, Tony Bibbs wrote:
>>>> You mean something like these?
>>>>
>>>> http://www.google.com/search?q=php%20form%20mail
>>>>
>>>> --Tony
>>>>
>>>> Dave J. Hala Jr. wrote:
>>>> > I'm looking for a way to take all the values posted from a form
>>>> > "pre
>>>> > format" them into an email. I'd then like to take that message and
>>>> > hand
>>>> > it off to PHP mailer.
>>>> >
>>>> > I remember a long time ago using some perl scripts that took whatever
>>>> > values were posted and then created a message and emailed it. Its was
>>>> > fairly painless. Has anyone seem anything like for php?
>>>> >
>>>> > :) Dave
>>>> >
>>>> _______________________________________________
>>>> ciapug mailing list
>>>> ciapug at cialug.org
>>>> http://cialug.org/mailman/listinfo/ciapug
>>> --
>>>
>>> Open Source Information Systems, Inc. (OSIS)
>>> Dave J. Hala Jr., President <dave at osis.us>
>>> 641.485.1606
>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Message: 4
>>> Date: Fri, 13 Jan 2006 14:03:55 -0600
>>> From: Scott Phillips <scott.phillips at DRAKE.EDU>
>>> Subject: [ciapug] php5
>>> To: ciapug at cialug.org
>>> Message-ID: <5.2.0.9.0.20060113135742.035716b0 at mail.drake.edu>
>>> Content-Type: text/plain; format=flowed; charset=us-ascii
>>>
>>> I was looking at an open source project for potential use here when I
>>> noticed it needs php5.
>>> (http://www.reservesdirect.org/wiki/index.php/Installation::Abbreviated)
>>> I
>>> believe this is the first time I've seen this required by any sort of
>>> major
>>> (large? complex?) software package. Anyone else started to see these
>>> popping up yet? Guess I'm getting behind the times.
>>>
>>>
>>> Scott Phillips
>>> Web Developer
>>> Cowles Library, Drake University
>>> (515) 271-2975
>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Message: 5
>>> Date: Fri, 13 Jan 2006 14:08:12 -0600
>>> From: Tony Bibbs <tony at tonybibbs.com>
>>> Subject: Re: [ciapug] php5
>>> To: ciapug at cialug.org
>>> Message-ID: <43C808AC.4050705 at tonybibbs.com>
>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>>
>>> I've started writing all my software for PHP5. It'll take quite some
>>> time for the ISP's to get 'comfortable' enough with it but without
>>> demand they won't change at all...I guess projects like the one you ran
>>> across help foster progress (even if it is at the frustration of a
>>> potential customer).
>>>
>>> --Tony
>>>
>>> Scott Phillips wrote:
>>>> I was looking at an open source project for potential use here when I
>>>> noticed it needs php5.
>>>> (http://www.reservesdirect.org/wiki/index.php/Installation::Abbreviated)
>>>> I believe this is the first time I've seen this required by any sort of
>>>> major (large? complex?) software package. Anyone else started to see
>>>> these popping up yet? Guess I'm getting behind the times.
>>>>
>>>>
>>>> Scott Phillips
>>>> Web Developer
>>>> Cowles Library, Drake University
>>>> (515) 271-2975
>>>> _______________________________________________
>>>> ciapug mailing list
>>>> ciapug at cialug.org
>>>> http://cialug.org/mailman/listinfo/ciapug
>>>
>>>
>>> ------------------------------
>>>
>>> _______________________________________________
>>> ciapug mailing list
>>> ciapug at cialug.org
>>> http://cialug.org/mailman/listinfo/ciapug
>>>
>>>
>>> End of ciapug Digest, Vol 9, Issue 5
>>> ************************************
>>
>
More information about the ciapug
mailing list