mailing: Need Help

Dear all,
I have created log in system with. In that when the user completes the registration process an auto reply(auto-reply@domain) will generate and sent this to users email id regarding about the user name and password (Lo gin Details). After formal approval from the admin the user will get a user activation mail with log in link.

But , my problem is these are work only for mail accounts from my domain only(test@domain). its not send any of above mentioned details to other mail services like gmail or yahoo etc.

i discussed this with some others, they said its the problem with your mail function configuration. but i didn’t get any needful information as am a beginner in PHP scripting.

i have contacted this with my hosting service they said its the problem with php mail () function and use php mailer() instead mail().
Am attaching my code along with this.
please give me a solution for the same…
[php]<?php

include ‘dbc.php’;

$err = array();

if($_POST[‘doRegister’] == ‘Register’)
{

foreach($_POST as $key => $value) {
$data[$key] = filter($value);
}

if(empty($data[‘full_name’]) || strlen($data[‘full_name’]) < 4)
{
$err[] = “ERROR - Invalid name. Please enter atleast 3 or more characters for your name”;
//header(“Location: register.php?msg=$err”);
//exit();
}

// Validate User Name
if (!isUserID($data[‘user_name’])) {
$err[] = “ERROR - Invalid user name. It can contain alphabet, number and underscore.”;
//header(“Location: register.php?msg=$err”);
//exit();
}

// Validate Email
if(!isEmail($data[‘usr_email’])) {
$err[] = “ERROR - Invalid email address.”;
//header(“Location: register.php?msg=$err”);
//exit();
}
// Check User Passwords
if (!checkPwd($data[‘pwd’],$data[‘pwd2’])) {
$err[] = “ERROR - Invalid Password or mismatch. Enter 5 chars or more”;
//header(“Location: register.php?msg=$err”);
//exit();
}

$user_ip = $_SERVER[‘REMOTE_ADDR’];

// stores sha1 of password
$sha1pass = PwdHash($data[‘pwd’]);

// Automatically collects the hostname or domain like example.com)
$host = $_SERVER[‘HTTP_HOST’];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER[‘PHP_SELF’]), ‘/\’);

// Generates activation code simple 4 digit number
$activ_code = rand(1000,9999);

$usr_email = $data[‘usr_email’];
$user_name = $data[‘user_name’];

$rs_duplicate = mysql_query(“select count(*) as total from users where user_email=’$usr_email’ OR user_name=’$user_name’”) or die(mysql_error());
list($total) = mysql_fetch_row($rs_duplicate);

if ($total > 0)
{
$err[] = “ERROR - The username/email already exists. Please try again with different username and email.”;

}

if(empty($err)) {

$sql_insert = "INSERT into users
(full_name,user_email,pwd,address,tel,fax,website,date,users_ip,activation_code,country,user_name
)
VALUES
(’$data[full_name]’,’$usr_email’,’$sha1pass’,’$data[address]’,’$data[tel]’,’$data[fax]’,’$data[web]’
,now(),’$user_ip’,’$activ_code’,’$data[country]’,’$user_name’
)
";

mysql_query($sql_insert,$link) or die(“Insertion Failed:” . mysql_error());
$user_id = mysql_insert_id($link);
$md5_id = md5($user_id);
mysql_query(“update users set md5_id=’$md5_id’ where id=’$user_id’”);
// echo “

Thank You

We received your submission.”;

if($user_registration) {
$a_link = "
ACTIVATION LINK\n
http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
";
} else {
$a_link =
"Your account is PENDING APPROVAL and will be soon activated the administrator.
";
}

$message =
"Hello \n
Thank you for registering with us. Here are your login details…\n

User ID: $user_name
Email: $usr_email \n
Passwd: $data[pwd] \n

$a_link

Thank You

Administrator
$host_upper


THIS IS AN AUTOMATED RESPONSE.
DO NOT RESPOND TO THIS EMAIL*
";

mail($usr_email, "Login Details", $message,
"From: \"Member Registration\" <auto-reply@$host>\r\n" .
 "X-Mailer: PHP/" . phpversion());

header(“Location: thankyou.php”);
exit();

 } 

}

?>

 

 

 

 

 

 

<?php if (isset($_GET['done'])) { ?>

Thank you

Your registration is now complete and you can login here"; <?php exit(); } ?>

 

<?php if(!empty($err)) { echo "
"; foreach ($err as $e) { echo "* $e
"; } echo "
"; } ?>
  <br>
  <form action="register.php" method="post" name="regForm" id="regForm" >
    <table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms">
      <tr> 
        <td colspan="2">Your Name / Company Name<span class="required"><font color="#CC0000">*</font></span><br> 
          <input name="full_name" type="text" id="full_name" size="40" class="required"></td>
      </tr>
      <tr> 
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td colspan="2">Contact Address (with ZIP)<span class="required"><font color="#CC0000">*</font></span><br> 
          <textarea name="address" cols="40" rows="4" id="address" class="required"></textarea> 
          <span class="example">VALID CONTACT DETAILS</span> </td>
      </tr>
      <tr> 
        <td>Country <font color="#CC0000">*</font></span></td>
        <td><select name="country" class="required" id="select8">
            <option value="" selected></option>
            
            <option value="Yugoslavia">Yugoslavia</option>
          </select></td>
      </tr>
      <tr> 
        <td>Phone<span class="required"><font color="#CC0000">*</font></span> 
        </td>
        <td><input name="tel" type="text" id="tel" class="required"></td>
      </tr>
      <tr> 
        <td>Fax </td>
        <td><input name="fax" type="text" id="fax">
        </td>
      </tr>
      <tr> 
        <td>Website </td>
        <td><input name="web" type="text" id="web" class="optional defaultInvalid url"> 
          <span class="example">http://www.example.com</span></td>
      </tr>
      <tr> 
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td colspan="2"><h4><strong>Login Details</strong></h4></td>
      </tr>
      <tr> 
        <td>Username<span class="required"><font color="#CC0000">*</font></span></td>
        <td><input name="user_name" type="text" id="user_name" class="required username" minlength="5" > 
          <input name="btnAvailable" type="button" id="btnAvailable" 
          onclick='$("#checkid").html("Please wait..."); $.get("checkuser.php",{ cmd: "check", user: $("#user_name").val() } ,function(data){  $("#checkid").html(data); });'
          value="Check Availability"> 
            <span style="color:red; font: bold 12px verdana; " id="checkid" ></span> 
        </td>
      </tr>
      <tr> 
        <td>Your Email<span class="required"><font color="#CC0000">*</font></span> 
        </td>
        <td><input name="usr_email" type="text" id="usr_email3" class="required email"> 
          <span class="example">** Valid email please..</span></td>
      </tr>
      <tr> 
        <td>Password<span class="required"><font color="#CC0000">*</font></span> 
        </td>
        <td><input name="pwd" type="password" class="required password" minlength="5" id="pwd"> 
          <span class="example">** 5 chars minimum..</span></td>
      </tr>
      <tr> 
        <td>Retype Password<span class="required"><font color="#CC0000">*</font></span> 
        </td>
        <td><input name="pwd2"  id="pwd2" class="required password" type="password" minlength="5" equalto="#pwd"></td>
      </tr>
      <tr> 
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td width="22%"><strong>Image Verification </strong></td>
        <td width="78%"> 
        <?php 
        require_once('recaptchalib.php');
        
            echo recaptcha_get_html($publickey);
        ?>
          
        </td>
      </tr>
    </table>
    <p align="center">
      <input name="doRegister" type="submit" id="doRegister" value="Register">
    </p>
  </form>
 
   
  </td>
<td width="196" valign="top">&nbsp;</td>
 
[/php]

If your script is sending emails to your email address, but not sending to Gmail, the problem is not in the php code. Problem is likely with your server IP address - it may be blacklisted, and services like Gmail or Yahoo will filter your messages and put them to SPAM folder. Try to do a test, and then login to Gmail and check your SPAM folder.

Hi,
its not thr in the Spam fldr. i dscsd this with my hosting provider, hey said its the problem with php mail () function and use php mailer() instead mail().

Sponsor our Newsletter | Privacy Policy | Terms of Service