Not receiving emails from form

Hello, I have built a website and a form for entry into a band contest. I followed several tutorials to create a php script to send the form to my email but am not receiving the emails. I checked spam filters and also uploaded a test php to ensure that I am capable of receiving emails. This leads me to believe I have some issue with my script. Please help!!!

<?php /* Subject and Email Variables */ $emailSubject = 'RGV Entry'; $webMaster = '[email protected]'; /* Gathering Data Variables */ $schoolField = $_POST['school']; $classificationField = $_POST['classification']; $otherField = $_POST['other']; $addressField = $_POST['address']; $cityField = $_POST['city']; $zipField = $_POST['zip']; $phoneField = $_POST['phone']; $cellField = $_POST['cell']; $emailField = $_POST['email']; $groupField = $_POST['group']; $directorField = $_POST['director']; $piece1Field = $_POST['piece1']; $composer1Field = $_POST['composer1']; $piece2Field = $_POST['piece2']; $composer2Field = $_POST['composer2']; $piece3Field = $_POST['piece3']; $composer3Field = $_POST['composer3']; $body = <<<EOD


School: $school
Classification: $classification
Other: $other
Address: $address
City: $city
Zip Code: $zip
School Phone: $phone
Director Cell Phone: $cell
Email: $email
Competing Group: $group
Groupd Director: $director
First Piece: $piece1
Composer: $composer1
Second Piece: $piece2
Composer: $composer2
Third Piece: $piece3
Composer: $composer3
EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD Contact Form
Thank you
Your message has been sent

Click here to Continue

 

EOD; echo "$theResults"; ?>

Reading through php.net, this might help I’m not sure.

error control operator (@) with heredoc syntax
the error control operator is pretty handy for supressing minimal errors or omissions. For example an email form that request some basic non mandatory information to your users. Some may complete the form, other may not. Lets say you don’t want to tweak PHP for error levels and you just wish to create some basic template that will be emailed to the admin with the user information submitted.

[php]$body = @<<<EOD




School: $school

Classification: $classification

Other: $other

Address: $address

City: $city

Zip Code: $zip

School Phone: $phone

Director Cell Phone: $cell

Email: $email

Competing Group: $group

Groupd Director: $director

First Piece: $piece1

Composer: $composer1

Second Piece: $piece2

Composer: $composer2

Third Piece: $piece3

Composer: $composer3

EOD;[/php]

Hi,

First off, make sure your server is capable of sending emails. Ask the IT guys or contact the hosting company.

Execute this piece of code:

[php]if(mail($webMaster, $emailSubject, $body, $headers)){
echo “Success”;
}
else{
echo “Failed”;
}
[/php]

If failed, try to send the email in plain text; remove HTML tags, etc… If still no luck, use GeekMail – it’s a library that simplifies sending of emails…

Sponsor our Newsletter | Privacy Policy | Terms of Service