Form doesn't work properly


#1

I’m not sure if this is the right place to ask this, and if it isn’t, I apologize, but I don’t know where else I can go, and I’m at my wit’s end at this point.

The problem is this: The form I’m having a problem with is for a website I am building which will archive stories people have written and submitted to me. I want to be able to use this to mail directly to the e-mail account of the author of the story the reader has just viewed, and I want to be able to use this individually for every author. It e-mails just fine, but it only e-mails to my e-mail account (which is absolutely nowhere to be found in the form that I can see). It has an entry for me to change an e-mail address, but I tested it with a friend’s e-mail, and it still sent it to me. Only instead of the “From” name being “noble_knight@blahblah” (my e-mail) it was my friend’s e-mail address.

Here is the coding. It was made for me by someone else who I have lost contact with, so I have no idea what I should do, and I’m afraid to do anything lest it I completely break it.

[php]
[b]<?php

$myemail=“From: noble_knight@cwazy.co.uk”;
$subject=$name." - ".$title;
$message=$comments;

if (mail($email,$subject,$message,$myemail))
{
echo ’
The message was sent OK
(Insert whatever HTML you like here up until the line with the :wink:
If you use an apostrophe, you must type it this way with a backslash first: ’

';

}
else
{
echo ’
The message was not sent, you lose, game over
(Insert whatever HTML you like here up until the line with the :wink:
If you use an apostrophe, you must type it this way with a backslash first: ’

';

}
?>[/b][/php]

Thank you in advance for anyone who can help me.


#2

Hi NKfloofiepoof,

Ok, the part of the mail() function that sends the mail is the first part, ie your $email variable.

So, how is the data getting passed to this variable? If there is no data getting passed, then you are missing a variable:

$email = "noble_knight@cwazy.co.uk"; $myemail="From: "; $subject=$name." - ".$title; $message=$comments;

The $myemail variable is the header information. You might also want to add a name to that. ie:

$myemail=“From: Your Namenoble_knight@cwazy.co.uk”;

Hope that helps. :)


#3

Yes, it works now! Thank you so much. :D