PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Gimpy
Forum Commoner
Posts: 42 Joined: Tue Jun 14, 2005 1:12 am
Location: Fort Worth, TX, US
Contact:
Post
by Gimpy » Sun Feb 18, 2007 1:27 pm
Ok, I cant understand why this isnt doing anything, maybe some one can point me in the right direction to help fix this.
When it tries to send it doesnt give me a confirmation and/or a error like it should..I'm still a lil green at php and maybe I just another set of eyes to look at it.
Code: Select all
///////////////////////////
//Begin Configuration
///////////////////////////
// Your email
$to = "bw.gimpy@gmail.com" . ", " ;
// Email Subject
$subject = "Game Directory filing" . "TX3Guilds.com";
// Server name, to display in the headers
$server_name = "TX3Guilds.com";
///////////////////////////
//End Configuration
///////////////////////////
if (!empty($_POST['send']) || !empty($_GET['send']))
{
$action = (!empty($_POST['send'])) ? $_POST['send'] : $_GET['send'];
}
else
{
$action = '';
}
$build_message = false;
if($action != "")
{
$build_message = true;
$message = $_POST['games'];
$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
//$time = time();
$date = date("F j, Y", time());
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8\r\n";
$headers .= "From: $email\r\n";
$headers .= "X-mailer: " . $server_name . " Server\r\n";
}
if($build_message)
{
/* message */
$message = "
Sender Name: $name\n
Sender E-Mail: $email\n
Date Sent: $date\n
Message:\n----------------------------------------\n$message \n$website\n";
if(mail($to, $subject, $message, $headers))
{
$result = "<b>Thank you</b>.<br />I will get back to you very soon.<br />";
}
else
{
$result = "Sorry: An error occured, please try again later.";
}
}
// Output a result Message
print $result;
Thanks in Advance,
Bryan "gimpy"
Last edited by
Gimpy on Mon Feb 19, 2007 12:59 am, edited 2 times in total.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Feb 18, 2007 1:31 pm
Are you sure
mail() is being called?
Gimpy
Forum Commoner
Posts: 42 Joined: Tue Jun 14, 2005 1:12 am
Location: Fort Worth, TX, US
Contact:
Post
by Gimpy » Sun Feb 18, 2007 1:38 pm
I turned on error reporting after I read a post about the "batch email" topic after I was working on my post and this is what I recieved.
Notice: Undefined variable: result in /home/bryanund/public_html/test/tx2guildsnew/comm_file.php on line 65
line 65 is
And to be honest, I dont really think that mail is being called.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Feb 18, 2007 1:43 pm
That error would indicate it is not.
Mordred
DevNet Resident
Posts: 1579 Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria
Post
by Mordred » Sun Feb 18, 2007 3:25 pm
You will observe, that regardless of the success of mail(), $result is set, so the only possibility of $result not being set is not to enter the if($build_message)
The reason it's not working is that you don't have a $_GET or $_POST variable named 'send'. Are you sure that your form has a submit button with name="send" ?
Gimpy
Forum Commoner
Posts: 42 Joined: Tue Jun 14, 2005 1:12 am
Location: Fort Worth, TX, US
Contact:
Post
by Gimpy » Mon Feb 19, 2007 1:01 am
That was it, thank you, I cant believe I was being complete green about that
Oh well thanks for your help just need to make it where it checks for correct emails and website format.