mail function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swethak
    New Member
    • May 2008
    • 118

    mail function

    hi,

    i used the below mentioned code mail function didn't work.that means it didn't give any error and also mail didn't receive.plz tell that what's the mistake

    and my php.ini contains
    [code=ini]
    [mail function]
    ; For Win32 only.
    SMTP = localhost ; for Win32 only
    sendmail_from= me@localhost.co m ; for Win32 only
    SMTP_PORT=25;

    ; For Win32 only.
    sendmail_from = me@example.com
    SMTP_PORT=25
    [/code]

    [php]
    <?php
    ini_set ("SMTP","localh ost");
    ini_set("SMTP_P ORT","25");
    $to ="__MUNGED__ ";
    $subject = "Site Registration Confirmation";
    $message = '<html>
    <head>
    <title>Site Registration Confirmation</title>
    </head>
    <body style=font-family:verdana, arial; font-size: .8em;>
    You filled out a registration form
    <br/><br/>
    </body>
    </html>';
    //headers type to sent the mail
    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\n";
    $headers .= "X-Priority: 3\n";
    $headers .= "X-MSMail-Priority: Normal\n";
    // from address is take what ever we want
    $from ="me@example.co m";
    $headers .= "From:$from ";
    //mail function
    mail($to,$subje ct,$message,$he aders);
    ?>

    [/php]
    Last edited by pbmods; Jul 23 '08, 12:01 AM. Reason: Added CODE tags, removed email.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    What happened to the advice given in this thread?

    Comment

    • swethak
      New Member
      • May 2008
      • 118

      #3
      Originally posted by r035198x
      What happened to the advice given in this thread?

      i used as

      sendmail_from=m y email id ; in php.ini.But in that we didn't get any error and mail didn't receive.plz tell that what's the solution.

      Comment

      • nitinpatel1117
        New Member
        • Jun 2007
        • 111

        #4
        the mail function can only send emails if you have everything else on your server setup properly: like running SMTP as a service and having your mail server setup. properly.

        Also, you email address is not: me@example.com because you do not own example.com domain so you can't send from that address.

        Comment

        Working...