help with email script...
Posted on
16th Feb 2014 07:03 pm by
admin
hey
I need help with my mail script
when the form on http://www.mcgdesignstudio.com/contact.html is filled out, it send the from with no errors.. however i never receive it..
my hosting company have told me as long as i have the fourth element in if -f or something it will work, dunno where to put that though..
this is my script:
Code: <?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/b[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([.-][a-z0-9]+)*)+"."\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','message');
$required = array('name','email','message');
$your_email = "martin@mcgdesignstudio.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
if( empty($_POST[$value]) ) { echo 'You need to fill in all the required fields...'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."n";
}
}
if(mail("$your_email", "$email_subject", "$email_content",
"To: Martin Greenwood <$your_email >n" .
"From: mcgdesignstudio.com <martin@mcgdesignstudio.com>n" .
"MIME-Version: 1.0n" .
"Content-type: text/html; charset=iso-8859-1"
)){
echo 'Your message has been sent successfully..';
} else {
echo 'Oops, something went wrong...try again later.';
}
}
?>
No comments posted yet
Your Answer:
Login to answer
136
52
Other forums
Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have
Show message after entering data
Hello Colleagues
I would like to display messages after entering the data example: "
dat
Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand,
OOP help
okay so i have a class im making it has everything setup i just need to randomize the 2 variables an
Working with Dates, help.
Sooo to make a long story short, here's what im trying to accomplish.
I need to create a drop
ScriptManager History and Opera Issue
I am having an issue in opera with the ScriptManager. I have a ScriptManager on a page with history
help me, how to find text on an external html site using PHP
Would anyone know how to search an external html file for a work or phrase ?
I was thinking s
PHP Directory Listing Not working
Hey Guys,
I need help, I tried a ton of directory listing scripts and they all don't work. Al
php or sql?
Sorry not sure if this is a sql problem or php the following code is supposed to delete data from th
I need an iframe that calls up a different page according to the date
hi
I don't know any php (only html) and I urgently need to do the following:
I need a