RE: Form to email "from" field help needed

by "Tombs" <hwg(at)Kender.org>

 Date:  Tue, 26 Oct 2004 15:12:53 -0500
 To:  "'Jeff Nelson'" <nelson_j(at)speakeasy.net>,
<hwg-techniques(at)hwg.org>
 In-Reply-To:  Kender
  todo: View Thread, Original

$priority =3D 0;  // Should the mail be sent priority? (0 =3D No, 1 =3D =
Yes)

$toemail =3D "\"your name\" <alpha(at)beta.com>";  // Who to send it to?


Those shoule be separate lines
-----Original Message-----
From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org] =
On
Behalf Of Tombs
Sent: Tuesday, October 26, 2004 14:55
To: 'Jeff Nelson'; hwg-techniques(at)hwg.org
Subject: RE: Form to email "from" field help needed


Pardon if this was sent multiple times, was having an issue with my mail
client.


This is a basic one, does not have user set subject, but using this code =
you
can see how easily that can be added

Any more questions, feel free to write!

J. Wheeler
Owner - Kender Internet Kompany
http://kender.org

// ----------------------START CODE---------------------------//

<?
if (isset($_GET['action'])) { $action =3D $_GET['action'];=09
if ($action =3D=3D "send"){sendmail();}}
else {
?>

<p>
&nbsp;=20
</p>
<p align=3D"center">
Send us a note about how we're doing.
</p>

<form action=3D"./contact.php?action=3Dsend" method=3D"post"
enctype=3D"multipart/form-data">
<table align=3D"center">
  <tr>
    <td align=3D"right" class=3D"me">Your Name:&nbsp; </td>
    <td align=3D"left" class=3D"me"><input type=3D"text" size=3D"25"
name=3D"name"></td>
  </tr>
  <tr>
    <td align=3D"right" class=3D"me">Your E-mail:&nbsp; </td>
    <td align=3D"left" class=3D"me"><input type=3D"text" size=3D"25"
name=3D"email"></td>
  </tr>
  <tr>
    <td align=3D"right" class=3D"me">Your Message:&nbsp; </td>
    <td align=3D"left" class=3D"me"><textarea cols=3D"35" =
rows=3D"7"></textarea>
</td>
  </tr>
  <tr>
    <td align=3D"center" colspan=3D"2" class=3D"me"><br /><input =
type=3D"submit"
value=3D" Send "></td>
  </tr>
</table>
</form>

<?
}

function sendmail(){
global $settings;

$priority =3D 0;  // Should the mail be sent priority? (0 =3D No, 1 =3D =
Yes)
$toemail =3D "\"your name\" <alpha(at)beta.com>";  // Who to send it to?

$mail =3D "
<html>
<head>
  <title>The contents of the form submitted at =
beta.com/contact.php</title>
</head>
<body>=09
Here are the contents of the form:<br><br>";
foreach ($_POST as $key =3D> $value){
	$mail .=3D "<b>$key</b>: ".nl2br($value)." <br>";
}
$mail .=3D "
</body>
</html>
";
  =20
	$headers =3D "MIME-Version: 1.0\n";
	$headers .=3D "Content-type: text/html; charset=3Diso-8859-1\n";
if ($priority){
	$headers .=3D "X-Priority: 1\n";
	$headers .=3D "X-MSMail-Priority: High\n";
}
	$headers .=3D "X-Mailer: php\n";
  	$headers .=3D "From: \"$_POST[name]\" <$_POST[email]>\n";

   mail ($toemail, "Form sent from: http://beta.com", $mail, $headers);
=20
echo 'Thank you for your submission.';
}

?>


// -----------------------END CODE----------------------------//

-----Original Message-----
From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org] =
On
Behalf Of Jeff Nelson
Sent: Monday, October 25, 2004 23:22
To: hwg-techniques(at)hwg.org
Subject: Re: Form to email "from" field help needed

On Mon, Oct 25, 2004 at 03:12:28PM -0500, Tombs wrote:
> You might be better off using a PHP page to parse the information and =
then
> send it.

Why?

> 1) It is able to perform all mail functions with one page

Why is this relevant?

> 2) You can assign the To: From: Subject: lines, or have the user input
them
> 	Or if the user leaves them blank (NULL) you can assign a generic one

The same as the NMS script.

> 3) You can allow the user to review before submitting

This is lacking in the NMS script, however it would be trivial to add
this functionality.

> All of that, with less code than the CGI mailers.

Less code is a good thing. Please post your code.

Have a great day!
-jeff

> James Wheeler
> Owner - Kender Internet Kompany
> http://kender.org
>=20
> -----Original Message-----
> From: owner-hwg-techniques(at)hwg.org =
[mailto:owner-hwg-techniques(at)hwg.org]
On
> Behalf Of R & L Rasmussen
> Sent: Monday, October 25, 2004 13:56
> To: hwg-techniques(at)hwg.org
> Subject: Form to email "from" field help needed
>=20
> hello,  I have been periodically using the nms form script upgrade to=20
> matt's original.
> I need help with one issue that is eluding me:  what script entries=20
> (presumably within
> the form tags on the web page itself)  do i include so that the form, =
when

> it's received,
> will include the person's email address *both* in the form and also in =
the

> "from" field of
> the email - before opening to view the form information?   I get the =
email

> in the body of the form
> but when the form is received the "from" field displayed in the email=20
> client is empty.
> all help sincerely appreciated.
> tia, ralph rasmussen
>=20
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
> =20
>=20
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
> =20

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 10/22/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 10/22/2004
=20

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 10/22/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 10/22/2004
=20

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.