We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17802
    • 190 Posts
    I love MODx but I’m having some problems with my install. embarrassed
    The latest problem is: when creating a new user, I get an error when sending them their (generated) password. The alert I’m receiving is: "Error while sending mail to". Apart from that, the new user is being created, except off course they can’t login, because they never received their password.
    I’ve checked with the provider whether php Safe Mode is enabled, but this isn’t the case. Any ideas? Please?

    Edit: server info:
    PHP: 4.4.4-0.dotdeb.1
    MySQL: 4.1.15
    Server: Apache/1.3.33 (Debian GNU/Linux)
      Thanks for MODx - I love it!
      • 22815
      • 1,097 Posts
      Have you double-checked that your send-from addresses are set correctly?
        No, I don't know what OpenGeek's saying half the time either.
        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
        Forum: Where to post threads about add-ons | Forum Rules
        Like MODx? donate (and/or share your resources)
        Like me? See my Amazon wishlist
        MODx "Most Promising CMS" - so appropriate!
        • 17802
        • 190 Posts
        Hmmm.. what do you mean by ’correctly’? I have found only one place where I can set a ’from’ address: administration > system configuration > e-mailaddress. I have used my own address, which is not in the same domain as the site itself. I don’t think any e-mailadresses have been configured for this domain. Could this be the problem?
        How can I tell what the from-address should be?
        Oh- and thanks, of course wink
          Thanks for MODx - I love it!
          • 22815
          • 1,097 Posts
          Some providers will limit you to sending from email addresses that are not set up on the box, so yes that *could* be the problem.

          Do any other mail scripts work?

          Oh, and can you please confirm what version of MODx you are using, and confirm that you are talking about the facility in the Manager for adding users?
            No, I don't know what OpenGeek's saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 17802
            • 190 Posts
            Other mailscripts do work. I just put up a testpage (outside of MODx) with a form I made myself and it works. This form takes the user input and puts it inside an email that is being sent to a certain (hardcoded) address. For ’sender’ I used the same address as in MODx.
            I’m using version 0.9.2.1 and yes, we are talking about the manager: Users > Manage Users > New User

            Also, I’m not sure if this is relevant, but in my phpinfo file it says:
            sendmail_path:	/usr/sbin/sendmail -t -i -f [email protected]   |   /usr/sbin/sendmail -t -i -f [email protected]

              Thanks for MODx - I love it!
              • 22303 MODX Staff
              • 10,725 Posts
              It may be that the internal script is not setting the return-path (the -f switch) properly and trying to send the email as [email protected]. I’ll have to look into this, but that’s my first inclination.
                • 17802
                • 190 Posts
                Do you mean a MODx internal script, and is there something I can do to solve this problem? Because I’d really like to solve it...
                  Thanks for MODx - I love it!
                  • 17802
                  • 190 Posts
                  So, I managed to solve the problem myself grin
                  I’m going to post here what I did in order to solve it, in case someone else gets the same problem in the future.
                  In the file manager > processors > save_user.processor.php I changed this line (line 446):
                  if(!mail($email, $emailsubject, $message, "From: ".$emailsender."\r\n"."X-Mailer: Content Manager - PHP/".phpversion(), "-f $emailsender")) {

                  into this:
                  if(!mail($email, $emailsubject, $message, "From: ".$emailsender."\r\n"."X-Mailer: Content Manager - PHP/".phpversion())) {

                  In other words: I removed the last part.
                  Perhaps one of the coders can tell me: did I do the right thing, or have I somehow made the script less secure or something? Because I’m not exactly a php expert...

                  Oh I think I also fixed a tiny bug in the line right below, which used to be:
                  webAlert("Error while sending mail to $mailto");

                  I changed ’$mailto’ into ’$email’, this way you get a proper error message with the emailaddress in it wink
                    Thanks for MODx - I love it!
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Apparently, your host does not allow setting the return-path switch (the -f part which you removed), which is unfortunate, since that means that all mail you send will have whatever return-path the host provider has configured for you.
                      • 17802
                      • 190 Posts
                      I see. Oh well, we can live with that. Thanks for your help! smiley
                        Thanks for MODx - I love it!