how to set the ini_set in my php program

Discussion in 'PHP' started by kumar84, Jul 12, 2007.

  1. #1
    hai friends

    Whether iam able to send the email through my local host to any of the email id

    So I have typed this program and i have sent the email, while running this php program i get an error that


    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in G:\html\mail.php on line 24


    So how to set the ini_set in my program can anybody help me how to set the ini_set

    If any body knows this sent me the answer

    Thank u in advance

    My php program is mail.php is below


    <?

    $to="";
    $fromname="";
    $fromemail="";
    $subject="";
    $msg="";

    $to=$_POST['to'];
    $fromname=$_POST['frname'];
    $fromemail=$_POST['fremail'];
    $subject=$_POST['sub'];
    $msg=$_POST['mes'];


    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$fromname." <".$fromemail.">\r\n";
    $msg = stripslashes($msg);
    mail($to,$subject,$msg,$headers);


    ?>
    <body>
    <center>

    <form action="mail.php" method="post">

    <table>

    <tr>
    <td>To</td>
    <td><input type="text" name="to"></td>
    </tr>

    <tr>
    <td>FromName</td>
    <td><input type="text" name="frname"></td>
    </tr>

    <tr>
    <td>FromEmail</td>
    <td><input type="text" name="fremail"></td>
    </tr>

    <tr>
    <td>Subject</td>
    <td><input type="text" name="sub"></td>
    </tr>

    <tr>
    <td><textarea name="mes" rows=5 cols=35></textarea></td>
    </tr>

    <tr>
    <td>
    <input type="submit" name="submit" value="SEND">
    </td>
    </tr>

    </table>
    </form>
    </center>
    </body>
    [​IMG] [​IMG]
     
    kumar84, Jul 12, 2007 IP
  2. jazz7620

    jazz7620 Banned

    Messages:
    357
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you try

    ini_set("SMTP","mail.yourdomain.com");
    ini_set("smtp_port","25");
     
    jazz7620, Jul 12, 2007 IP