tags:

views:

130

answers:

1

Possible Duplicates:
how to send email with graphic via php
how to send mail using php?

<?php 
$error_occured = "no";
$name = $_POST['name']; 
$b_name = $_POST['b_name'];
$number = $_POST['number'];
$email_address = $_POST['email'];
$situation = $_POST['situation'];
$checkup = $_POST['brand_checkup'];
$bb_workshop = $_POST['BB'];
$recommend = $_POST['Recommend'];
$creative = $_POST['Creative_Team'];
$nominate = $_POST['Nominate']; 
$inspired = $_POST['Inspired']; 
$subject = $_POST['subject']; 

if($error_occured=="no") { 

$to = "michelle@localhost"; 
$email_from = $email_address; 
$email_subject = "New mail from www.enyeheri.com!";
$email_body = "You have received a new message. Here are the details: \n\nName:" .$name . " \n\n Business Name:" .$b_name. "\n\n Business Number: " . $number ."\n\n Email Address:" .$email_address . "\n\n Business Situation:" .$situation . "\n\n Brand Check-up: " . $checkup . "\n\n BB workshop: " .$bb_workshop . "\n\n Recommendation: " .$recommend . "\n\n Creative Team: " .$creative . "\n\n Nominate: " .$nominate . "\n\n Inspired: " .$inspired ; 
$headers = "From: $email_from"; 
mail($to,$email_subject,$email_body,$headers);
echo "Your message was sent successfully";
} 
?>
+1  A: 

mail()

http://uk3.php.net/manual/en/function.mail.php

The return value of this function is a bool. You should use that to determine if the mail was sent successfully.

You may want to check out the double quoted strings and heredoc string:

$name = 'Benedict';

$greeting = 'Hello ' . $name . '\n Would you like a cup of tea?';
$greeting = "Hello $name \n Would you like a cup of tea?";
$greeting = <<<GREETING
Hello $name
Would you like a cup of tea?
GREETING;

All 3 $greetings are the same.

Benedict Cohen