Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. The joys of PHP mail()

The joys of PHP mail()

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
phpcomsysadmincollaborationbeta-testing
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SRJ92
    wrote on last edited by
    #1

    <?php
    $to = "someone@domain.com";
    $subject = "Test";
    $message = "Hello";
    $from = "someonelse@domain.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>

    as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...

    D C 2 Replies Last reply
    0
    • S SRJ92

      <?php
      $to = "someone@domain.com";
      $subject = "Test";
      $message = "Hello";
      $from = "someonelse@domain.com";
      $headers = "From: $from";
      mail($to,$subject,$message,$headers);
      echo "Mail Sent.";
      ?>

      as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...

      D Offline
      D Offline
      Dr Walt Fair PE
      wrote on last edited by
      #2

      I have a similar setup and I don't see anything wrong with what you have, so unless I'm blind it looks like it should indeed work. In fact what you have is almost identical to the php documentation. Are you sure the server email system is working and has the correct settings in the php.ini file?

      CQ de W5ALT

      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

      S 1 Reply Last reply
      0
      • D Dr Walt Fair PE

        I have a similar setup and I don't see anything wrong with what you have, so unless I'm blind it looks like it should indeed work. In fact what you have is almost identical to the php documentation. Are you sure the server email system is working and has the correct settings in the php.ini file?

        CQ de W5ALT

        Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

        S Offline
        S Offline
        SRJ92
        wrote on last edited by
        #3

        turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP? could i send the information to another website easily or ?

        D F 2 Replies Last reply
        0
        • S SRJ92

          turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP? could i send the information to another website easily or ?

          D Offline
          D Offline
          Dr Walt Fair PE
          wrote on last edited by
          #4

          I'm not an expert in PHP mail, but I think the mail server needs to be set in the php.ini file if using Windows. If Linux, then you'll have to do something different to use a remote SMTP server. Here are a couple of links that might help: http://email.about.com/od/emailprogrammingtips/qt/Configure_PHP_to_Use_a_Remote_SMTP_Server_for_Sending_Mail.htm[^] http://email.about.com/gi/o.htm?zi=1/XJ&zTi=1&sdn=email&cdn=compute&tm=112&f=10&tt=13&bt=1&bts=1&zu=http%3A//pear.php.net/package/Mail[^] Take a look at PEAR, too.

          CQ de W5ALT

          Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

          1 Reply Last reply
          0
          • S SRJ92

            <?php
            $to = "someone@domain.com";
            $subject = "Test";
            $message = "Hello";
            $from = "someonelse@domain.com";
            $headers = "From: $from";
            mail($to,$subject,$message,$headers);
            echo "Mail Sent.";
            ?>

            as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...

            C Offline
            C Offline
            chiryphp
            wrote on last edited by
            #5

            class SafeEmail 30 { 31 function create($user, $host, $suffix) 32 { 33 $at = "@"; 34 $dot = "."; 35 36 $start = $user . at . $host; 37 $end = $dot . $suffix; 38 $address = $start . end 39 40 return $address; 41 } 42 43 $se = new SafeEmail(); 44 $se->create($user, $host, $suffix); 45 } More php email scripts listed on the page!

            1 Reply Last reply
            0
            • S SRJ92

              turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP? could i send the information to another website easily or ?

              F Offline
              F Offline
              Fatih P
              wrote on last edited by
              #6

              look for class.smtp.php from Chris Ryan. that s good one for start to send mails using your smtp server.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups