Forum Moderators: coopster

Message Too Old, No Replies

mail() Will Not send Mail

         

redrice23

4:39 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



______PHP SCRIPT

<?php
$name = $_REQUEST['name'] ;
$position = $_REQUEST['position'] ;
$company = $_REQUEST['company'] ;
$tel = $_REQUEST['tel'] ;
$email = $_REQUEST['email'] ;
$type = $_REQUEST['type'] ;
$guests = $_REQUEST['guests'] ;
$location = $_REQUEST['location'] ;
$comments = $_REQUEST['comments'] ;

mail( "example@gmail.com", "***Contact Us Form Results***",
"Name: $name" .
"Position: $position" .
"Company: $company" .
"Phone Number: $tel" .
"Email: $email" .
"Type of Event: $type" .
"Number of Guests: $guests" .
"Event Location: $location" .
"Comments: $comments" );

header( "Location: http://www.example.com/thankyou.html" );
?>

______
Form does not send email reply Can anyone help this is the first script ive ever written i have no clue whehe to go form here?

[edited by: eelixduppy at 5:30 pm (utc) on Dec. 28, 2007]
[edit reason] removed html [/edit]

eelixduppy

5:32 pm on Dec 28, 2007 (gmt 0)



Hello and Welcome to WebmasterWorld!

Are you getting any errors from this script? Is your SMTP settings set correctly? Have you checked your spam or bulk folders to see if the test email has found itself there? Check these things first to see what's going on.

redrice23

5:54 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



no there are no errors from the script, and the test message is not in the spam folde. How do verify the SMTP settings?

PHP_Chimp

6:03 pm on Dec 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Before you go off checking all sorts of more technical things like SMTP settings it may be worth having a try with this -

$to = // put in your email address
mail($to, 'TEST', 'Is this thing working?', 'From: chimp@example.com'."\r\n");

As the mail function has to have a from address. There is usually a default address set in php.ini...but it may be worth checking that this has actually been set, seeing as you didnt supply one.

redrice23

7:48 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



no luck there! anthing else i should be trying

PHP_Chimp

9:01 pm on Dec 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok try this -

$to = // put in your email address
$send = mail($to, 'TEST', 'Is this thing working?', 'From: chimp@example.com'."\r\n");
if ($send) {
echo 'Mail is working';
}
else {
echo 'Mail not working';
}

At least this will tel you if the mail call itself returns true or false. You will want a loop like this in the final script anyway, to deal with cases when the message isnt sent.

This function will only test that mail returns with true or false. This doesnt actually mean you will get the message as there are a lot of other unknowns in the path, so mail may return true and you still not get the message. However this is getting closer to narrowing down the problem.