PDA

View Full Version : Jubba - what am I missing?



Freddythunder
May 19th, 2003, 02:56 PM
Hey Jubba,
I've been trying to get your tut to work from this thread:

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=17313

I want to learn PHP and am brand new to it as of yesterday. I got seretha's tut to work to send me an email from flash, which is perfect, but I want to know why the HTML version isn't working for me. I get this error in my server's log:

[error] [client 66.167.132.49] (2)No such file or directory: Malformed header: No recipient addresses found in header

I got the error right away so I tried to figure it out myself:
I changed the email address (obviously) to my own and have been putzing around, moving tags around and trying to understand the $fromEmail part - what am I missing. Please forgive me for being new at this, but it's just frustrating me.

Thanks Jubba.
(-:

Jubba
May 19th, 2003, 03:19 PM
hmm... well, show me the codes you are using. Both the HTML and the PHP. That will help me debug it. :)

Freddythunder
May 19th, 2003, 03:46 PM
Okay..Thanks Jubba


<?
//------------------------------------------------
// File: 'phpmail.php'
// Func: using mail();
//------------------------------------------------

$Subject = "Test E-mail";
$toEmail = "kirupastuff@yahoo.com";

if(submit)
{
mail($fromEmail, $Subject, $nMessage."\nFrom: ".$fromName."<".$fromEmail.">");
}
?>
<html>
<head>
<title>Mail Tutorial</title>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="<? echo($PHP_SELF) ?>">
Your E-mail:

<input type="text" name="fromEmail" size="25">

Your Name: <input type="text" name="fromName" size="25">

Your Message:

<textarea cols="50" rows="5" name="nMessage">Your Message Here...</text>

<input type="submit" value="Submit">

</body>
</html>

Jubba
May 19th, 2003, 07:02 PM
<?
$Subject = "Test E-mail";
$toEmail = "kirupastuff@yahoo.com";

if(submit)
{
mail($toEmail, $Subject, $nMessage."\nFrom: ".$fromName."<".$fromEmail.">");
}
?>
<html>
<head>
<title>Mail Tutorial</title>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="<? echo($PHP_SELF) ?>">
Your E-mail:

<input type="text" name="fromEmail" size="25">

Your Name: <input type="text" name="fromName" size="25">

Your Message:

<textarea cols="50" rows="5" name="nMessage">Your Message Here...</text>

<input type="submit" value="Submit">

</body>

Freddythunder
May 19th, 2003, 07:19 PM
Alright, it works! I guess I should have read it a little better, I would have figured it I think. I also had to change </text> to </textarea> for it to work correctly. One more thing: You can't use all punctuation (i.e. apostrophe) when sending that email without it adding slashes in the sent email. Anyway around that?

Oh yeah...Thank you!!

Jubba
May 19th, 2003, 07:22 PM
yeah you would have to use stripslashes or something to that effect. I never had a need for it, so I don't really know how to use it effectively...

Freddythunder
May 19th, 2003, 07:27 PM
Alright, thanks man.
(-:

Freddythunder
May 19th, 2003, 07:55 PM
Hey Jubba - Look what I found:


<?
if (($REQUEST_METHOD=='POST')) {
////////////////////////////////
// This loop removed "dangerous" characters from the posted data
// and puts backslashes in front of characters that might cause
// problems in the database.
////////////////////////////////
for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, ">", " ");
$this = strtr($this, "<", " ");
$this = strtr($this, "|", " ");
$$key = $this;
}

I'm doing a guestbook...:thumb:

Jubba
May 19th, 2003, 08:08 PM
awesome :)