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 = "[email protected]";
$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
https://forums.phpfreaks.com/topic/72464-some-e-mail-addresses-not-working/
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);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.