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

    I have a problem with the sending Forgot Password emails. It seems that the headers are corrupted somehow.
    This is how the email looks:

    ...
    Subject: Password change request
    X-PHP-Originating-Script: 0:document.parser.class.inc.php(746) : eval()'d code
    MIME-Version: 1.0\nContent-type: text/html; charset=UTF-8
    From: "MODxnReply-To:no-reply"@66.240.163.36nX-Mailer:PHP/5.3.1
    
    <p>A request has been made to change the password on your account. <a href="http://66.240.163.36/manager/processors/login.processor.php?username=blackcat&hash=31f89a59340f8af87bfe50932475e170">Click here to complete the process.</a></p>
    <p>From there you will be able to change your password from the My Account menu.</p>
    <p><small>* The URL above will expire once you change your password or after today.</small></p>
    


    As you can see the headers are corrupted.



    I managed to track the code generation above to the siteCache.idx.php file and it looks like this:

    function sendEmail($to) {
                global $modx, $_lang;
                $subject = $_lang[\'password_change_request\'];
                $headers  = "MIME-Version: 1.0\\\\n".
                    "Content-type: text/html; charset={$modx->config[\'modx_charset\']}\\n".
                    "From: MODx\\\\n".
                    "Reply-To: no-reply@{$_SERVER[\'HTTP_HOST\']}\\\\n".
                    "X-Mailer: PHP/".phpversion();
    

    I think the problem is with the 3 back-slashes. The first 2 escape the last one which is supposed to do the line break.


    As you can see the problem is in generation the siteCache.idx.php file. But how is this file generated and from where I have no idea. Initial I thought it’s from the database more exactly the table modx_site_plugins/Forgot Manager Login entry. Changing the value in the database did not change the value generated in the cache file.

    I also deleted the cache file but the new file has the old code.

    So my questions are:

    1. Where do I find the code that generates the cache idx file for the $p[’Forgot Manager Login’] plugin?
    2. Is it possible that the 3 slashes are related to a server configuration?

    Thank You
      • 5340
      • 1,624 Posts
      It seems the code that generates the cache idx file for the $p[’Forgot Manager Login’] plugin is in the modx_site_plugins table. For some reason it took some time to get the correct value.

      So for anyone who has this problem you have to alter the header part in the modx_site_plugins table, Forgot Manager Login entry, plugincode colum to

      $headers  = "MIME-Version: 1.0 \n".
                      "Content-type: text/html; charset={$modx->config['modx_charset']} \n".
                      "From: modx \n".
                      "Reply-To: no-reply@{$_SERVER['HTTP_HOST']} \n".
                      "X-Mailer: PHP/".phpversion();


      Thx


        • 26931
        • 2,314 Posts
        thanks for sharing cipa!