Jump to content

Some E-mail Addresses Not Working


customcomputer

Recommended Posts

I'm running a simple Form script and certain e-mail addresses will receive the e-mails instantly and others will not, and I've waited days for them. Yahoo addresses work great, but everything else is a no go. I'm assuming the script is correct since it sends at least some e-mail, but maybe I'm missing something? Our hosting server is using PHP Version 4.3.2. Anybody have any ideas?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Contact Script</title>
</head>
<body>

<?php

// get posted data into local variables
$EmailTo = "rich@mydomain.com";
$Subject = "Web Contact";
$Name = Trim(stripslashes($_POST['Name'])); 
$City = Trim(stripslashes($_POST['City'])); 
$State = Trim(stripslashes($_POST['State'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 

// quick validation
$validationOK=true;
if (Trim($Email)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=index-6.html\">";
  exit;
}

// email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");

// redirect to success page 
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.html\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=index-6.htm\">";
}
?>
</body>
</html>

My form scipt is pretty basic as well:

<form METHOD="POST" ACTION="cont.php">
<table class="auto">
<tr>
<td style="padding-right:4px; padding-left:32px;">
Enter your name:<br />
<div class="form"><input name="Name" type="text" value=""></div>
<p>Your City: </p>
<div class="form"> <input name="City" type="text" value="" style='width:100px;'></div>
<p> Your State:</p>
<div class="form"><input name="State" style='width:30px'></div>
<p>Enter your e-mail:<br /></p>
<div class="form"><input type="text" value="" name="Email"></div>
Enter your message:<br />
<textarea name="Message" cols="20" rows="10"></textarea>
</td>
</tr>
</table>
<div style="margin-left:34px; margin-top:25px;"><input type="submit" name="submit" value="Submit"></div>
</form>

Link to comment
Share on other sites

OKay, lets go all out..:)

 

<?php

  $eol="\r\n";
  $mime_boundary=md5(time());

  # Common Headers
  $headers = "";
  $headers .= "From: ".$Email."<".$Email.">".$eol;
  $headers .= "Reply-To: ".$Email."<".$Email.">".$eol;
  $headers .= "Return-Path: ".$Email."<".$Email.">".$eol;    // these two to set reply address
  $headers .= "Message-ID: <".time()."-".$Email.">".$eol;
  $headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters

  # Boundry for marking the split & Multitype Headers
  $headers .= 'MIME-Version: 1.0'.$eol.$eol;
  $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary."\"".$eol.$eol;

// send email 
$success = mail($EmailTo, $Subject, $Body, $headers);

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.