We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8741
    • 17 Posts
    Hello,

    The emailing a new password function for a user used to work on our server (managed server, not shared hosting). Now all of a sudden it doesn’t work. Or rather, no email is ever received and I never see an error anywhere.

    I’ve looked through the forums and saw some posts that came close to what I’m looking for but didn’t quite give me enough info to go on. I’m relatively new to MODx.

    Can someone point me in the right direction to see where I can find out if the email is actually being generated? I need to figure out if this is a MODx issue, a PHP config issue, a mail server issue, or a hosting provider issue. (so many potential points of failure!)

      • 3749
      • 24,544 Posts
      One common cause it that your host just turned off the mail() function.

      You can try this code (in a snippet) with both a local and remote email address and see if the mail arrives. If not, it’s a problem with the host/server:



      // ---------------- SEND MAIL FORM ----------------
      
      // send e-mail to ...
      $to="me@localhost";
      
      // Your subject
      $subject="Test";
      
      // From
      $header="from: your name <your email>";
      
      // Your message
      $message="Hello \r\n";
      $message.="This is test\r\n";
      $message.="Test again ";
      
      // send email
      $sentmail = mail($to,$subject,$message,$header);
      
      // if your email succesfully sent
      if($sentmail){
      echo "Email Has Been Sent .";
      }
      else {
      echo "Cannot Send Email ";
      }
      
      ?>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 8741
        • 17 Posts
        Quote from: BobRay at Jun 05, 2009, 04:24 PM

        One common cause it that your host just turned off the mail() function.

        You can try this code (in a snippet) with both a local and remote email address and see if the mail arrives. If not, it’s a problem with the host/server:



        // ---------------- SEND MAIL FORM ----------------
        
        // send e-mail to ...
        $to="me@localhost";
        
        // Your subject
        $subject="Test";
        
        // From
        $header="from: your name <your email>";
        
        // Your message
        $message="Hello \r\n";
        $message.="This is test\r\n";
        $message.="Test again ";
        
        // send email
        $sentmail = mail($to,$subject,$message,$header);
        
        // if your email succesfully sent
        if($sentmail){
        echo "Email Has Been Sent .";
        }
        else {
        echo "Cannot Send Email ";
        }
        
        ?>


        I did an external test and received the email right away. This is weird... why would that work, but not receive password changes? Any other ideas?

        Hypothetically speaking, if my site was hacked, is there a place I could look where they could’ve changed the code to alter where the emails are sent?

        I appreciate your help!
          • 3749
          • 24,544 Posts
          You should be able to check the mail logs to see where things are going.

          First, check your system settings (tools | configuration | user tab) to see what your e-mail address is set to. I think that’s used in the FROM field and the host may not like what it’s set to.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 8741
            • 17 Posts
            Looks like it was a sendmail configuration issue. There wasn’t a default email address setup for "from". We’re now receiving the emails.

            Thanks for all of the help!
              • 3749
              • 24,544 Posts
              Glad you got it sorted. smiley
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting