Stephen Raj
Stephen Raj

Reputation: 41

Mail Function was not working

Mail function was not working, but i am getting success message,but mail was not sent My code is following ,but this code working fine on another one server i can't identify the problem any solution for in this problem.........?

    <?php
include("conn.php");

if(isset($_REQUEST["mmailid"]))
{
     $to=$_REQUEST["mmailid"];
$rs=mysql_query("select mmailid,mpass,mname from memtb where mmailid='$to'");

  $rd1=mysql_num_rows($rs);
    if($rd1>0)
    {
        $rd=mysql_fetch_array($rs);
             $headers = "MIME-Version: 1.0" . "\r\n";
             $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
             $headers .= 'Bcc: [email protected]' . "\r\n";


        $body="<table border=5 style='border-color:blue'><p><h3><img src='http://www.stephenraj.in/images/logo.jpg' alt='stephen Logo' /></h3></p><p>Dear " . $rd[2] . ",</p><p> &nbsp; &nbsp; Your Password is : " . $rd[1] . " .</p><p>" . "<p><h1>&nbsp;</h1></p><p>SUPPORT Team</p><p>CHANDRASTORE</p></table>";

         ini_set("SMTP","localhost");
         ini_set("sendmail_from","[email protected]");

        $mail=mail($to,"Stephen Password Recovery  MAIL",$body,$headers);
        //mail($tomailid,"Stephen Registration Confirmation MAIL",$body,$headers);
        if(isset($mail))
        {
        echo "Your Password Was Sent To Your Mail";
        // echo $rd[2].$rd[1];
        }
    }
    else
        echo 'Invalid Mail ID'
}


?>

Upvotes: 0

Views: 137

Answers (2)

sasi kanth
sasi kanth

Reputation: 2927

check with your hosting server..when ever we write a mail it will send through from our server first if your server to another doesn't have privilege or fire wall wont send.so check with your server hosting once

Upvotes: 1

rahulmishra
rahulmishra

Reputation: 621

This seems to be the problem i faced a while ago. I discovered in my case that the problem was with the firewall of the server. I contacted the server admin and he did things right. Maybe this is the same problem you are facing.

Upvotes: 1

Related Questions