flatrabbit
-
Posts
8 -
Joined
-
Last visited
Posts posted by flatrabbit
-
-
Soo....
I was referring to ereg and preg_match
-
Before we go any further, let's make sure this is a code problem and not a server problem. Create a new .php file and put only the following in to it:
<?php if (mail("seanmcpeak@comcast.net", "This is a test", "This is a test")) { echo 'success'; } else { echo 'fail'; }
Make sure the "seanmcpeak@comcast.net" is where you want the test to be sent.
Run the script on your GoDaddy server. If you get "success", make sure the mail is delivered. If it was, then we know it is a problem in your code above. If not, then something on the server is not configured properly.
No email and the page displayed 'fail'
-
Thanks for your help guys, but you're way over my head.
-
I don't understand. It came with a template. Its on a linux hosting account with GoDaddy running php 5.2
-
I have a simple php contact form:
http://brand32.com/clients/dark_water_media/Dark/contact.html
Upon clicking "Send" the message displays "Your message has been sent successfully!" but no email is received. I've changed the email in the code multiple times, but the same result (or lack thereof).
Here is the php code:
<?php
$receiverMail
= "seanmcpeak@comcast.net"; /* Your email */
$name
= ltrim(rtrim(strip_tags(stripslashes($_POST['name']))));
$email
= ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
$website
= ltrim(rtrim(strip_tags(stripslashes($_POST['website']))));
$msg
= ltrim(rtrim(strip_tags($_POST['msg'])));
$subject = $name ." - ".$website;
$ip
= getenv("REMOTE_ADDR");
$msgformat
= "From: $name ($ip)\nEmail: $email\n\n$msg"; /* MSG format */
// VALIDATION
if(empty($name) || empty($email) || empty($website) || empty($msg)) {
echo "<div id='status' class='error'>The email was not sent. Please fill all the required fields</div>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
echo "<div id='status' class='error'>The email was not sent. The email address is invalid</div>";
}
else {
mail($receiverMail, $subject, $msgformat, "From: $name <$email>");
echo "<div id='status' class='ok'>Your message has been sent successfully!</div"; }
?>
Thanks in advance.
-
Thanks Andrew, but no dice. Still getting the error.
-
Hello,
I'm having trouble with mail/contact script from a template I purchased. Thanks for your help in advance. Cheers.
SP
The Link:
http://brand32.com/clients/erin_partridge/contact.php
The error:
Parse error: parse error, unexpected '!' in /home/content/b/r/a/brand32/html/clients/erin_partridge/sendmail.php on line 63
The code:
<?php
$error = false;
$the_name = $_POST['stname'];
$the_email = $_POST['stemail'];
$the_website = $_POST['stwebsite'];
$the_message = $_POST['stmessage'];
if(!checkmymail($the_email))
{
$error = true;
$the_emailclass = "error";
}else{
$the_emailclass = "valid";
}
if($the_name == "")
{
$error = true;
$the_nameclass = "error";
}else{
$the_nameclass = "valid";
}
if($the_message == "")
{
$error = true;
$the_messageclass = "error";
}else{
$the_messageclass = "valid";
}
if($error == false)
{
$to = $_POST['emailreciever'];
$subject = "New Message from " . $_POST['sitename'];
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$header .= 'From:'. $_POST['email'] . " \r\n";
$message1 = nl2br($_POST['stmessage']);
$message = "New message from $the_name <br/>
Mail: $the_email<br />
Website: $the_website <br /><br />
Message: ” . $_POST[‘stmessage’] . “
”;
if(mail($to,$subject,$message,$header))
{
header( 'Location: contact.php?id=1' ) ;
}
}
function checkmymail($mailadresse){
$email_flag=preg_match("!^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$!",$mailadresse);
return $email_flag;
}
?>
Contact Form Not Sending Emails
in PHP Coding Help
Posted
Thanks man. I'll get to reading and check out PHPmailer. Great resources. Cheers.