|
-
Dec 20th, 2007, 05:00 PM
#1
Thread Starter
Member
Mail() Problem
Hey guys, I'm making a email script for my company and currently I've got it all rigged up and it should be working, but my email just won't work? What I mean by this is that, even thou I make it use Mail(mysettings etc) the email never comes to me. Could one of you check my script? Thanks.
Code:
<?php
// You may edit these to your likings.
$email = "[email protected]"; // Contact email, for visitors
$emailredirectpage = "emailsuccess.php"; // The page they will be re-directed too.
$emailmaxmessage = "500"; // Maximum characters for their message.
// Connected to main form, and grab necessary data.
$emailtitle = $_POST['title'];
$emailmsg = $_POST['message'];
// This is protection against any potential attacks.
$emailtitle = trim($emailtitle);
$emailtitle = preg_replace("/>/","]",$emailtitle);
$emailtitle = preg_replace("/</","[",$emailtitle);
// Finally email the client all the information.
//mail($email,$emailtitle,$emailmsg);
$headers = str_replace(”\r\n”,”\n”,$headers);
@mail ($email, $emailtitle, $emailmsg, $headers);
// End of script.
?>
-
Dec 20th, 2007, 05:40 PM
#2
Re: Mail() Problem
What value is in $headers?
-
Dec 20th, 2007, 05:53 PM
#3
Thread Starter
Member
Re: Mail() Problem
 Originally Posted by lintz
What value is in $headers?
Well I've removed that now, messy code I had. I've started using..
Code:
// Finally email the client all the information.
if(mail($email_address,$email_title,$email_msg))
{
echo "Succesfully Sent mail!";
//header("Location: $email_redirectpage");
}
else
{
echo "Something's wrong!";
}
And all I get back each time is "Something's wrong!"
-
Dec 20th, 2007, 05:55 PM
#4
Re: Mail() Problem
Right, make sure your php.ini file has the correct SMTP.
phpinfo() will show you this information
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|