Problem in mail sending

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

    Problem in mail sending

    Hi,

    i placed the php in windows server 2003 manually , set the path in Environmental variables , and place the php.ini file in windows.
    Now php works fine in my server sytem.When i write the mail sending code and run that program mail didn't sent.
    in my php.ini file consists the
    smtp=localhost
    smtp_port=25
    sendmail_from=m e@localhost.com
    In my smtp settings:
    Internet Information Services->righclick on default virtual smtp server->properties->Access tab->Relay->add the my system IP address and 127.0.0.1 ip address .

    We think there is no problem from smtp settings.Becaus e we run the jsp mail sending in same server machine .It works fine and mail sent .

    Here is the php code we have used
    Code:
    <?php
    $to ="email@domain.com";
    $subject = "Test Mail";
    $message = "hello how are you";
    $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 = "me@example.com";
    $headers .= "From: $from";
    mail($to,$subject,$message,$headers);
    ?>
    Please tell that whats the probelem in that.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    PHP's mail() function doesn't use the smtp server. (see manual entry below)

    if you want to use your smtp server, try Swift Mailer or PHP Mailer
    Originally posted by php.net
    Requirements

    For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them. PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary.

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      Does your smtp server require a username and password or authentication?


      Dan

      Originally posted by swethak
      Hi,

      i placed the php in windows server 2003 manually , set the path in Environmental variables , and place the php.ini file in windows.
      Now php works fine in my server sytem.When i write the mail sending code and run that program mail didn't sent.
      in my php.ini file consists the
      smtp=localhost
      smtp_port=25
      sendmail_from=m e@localhost.com
      In my smtp settings:
      Internet Information Services->righclick on default virtual smtp server->properties->Access tab->Relay->add the my system IP address and 127.0.0.1 ip address .

      We think there is no problem from smtp settings.Becaus e we run the jsp mail sending in same server machine .It works fine and mail sent .

      Here is the php code we have used
      Code:
      <?php
      $to ="email@domain.com";
      $subject = "Test Mail";
      $message = "hello how are you";
      $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 = "me@example.com";
      $headers .= "From: $from";
      mail($to,$subject,$message,$headers);
      ?>
      Please tell that whats the probelem in that.

      Comment

      • swethak
        New Member
        • May 2008
        • 118

        #4
        Originally posted by dlite922
        Does your smtp server require a username and password or authentication?


        Dan

        No.I put the option as Anonymous access.So i didn't set the username and password.

        Please give the suggestion.

        Comment

        Working...