V
V
vladimir percov2016-10-01 06:47:30
PHP
vladimir percov, 2016-10-01 06:47:30

How to send password reset email via MODX Revo API?

Good day!
How do I reset my password via the MODX Revo API so that an email with a reset link is sent properly?
I tried to run such a snippet, but no letter is generated (?) and does not fall on the mail.

<?php
define('MODX_API_MODE', true);
require 'index.php';
....
$output = $modx->runSnippet('ForgotPassword',array(
   'username' => '[email protected]',
'emailTpl' => 'lgnActivateEmailTpl',
...
));

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vladimir percov, 2016-10-01
@Arhimed96

While using this crutch:

function fsock_post_async($url, $params)
{
    foreach ($params as $key => &$val) {
      if (is_array($val)) $val = implode(',', $val);
        $post_params[] = $key.'='.urlencode($val);
    }
    $post_string = implode('&', $post_params);

    $parts=parse_url($url);

    $fp = fsockopen($parts['host'],
        isset($parts['port'])?$parts['port']:80,
        $errno, $errstr, 30);

    $out = "POST ".$parts['path']." HTTP/1.1\r\n";
    $out.= "Host: ".$parts['host']."\r\n";
    $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
    $out.= "Content-Length: ".strlen($post_string)."\r\n";
    $out.= "Connection: Close\r\n\r\n";
    if (isset($post_string)) $out.= $post_string;

    fwrite($fp, $out);
    fclose($fp);
}

I send straight to the script, it's a shame.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question