phpmailer debug output to html variable

前端 未结 1 1692
醉酒成梦
醉酒成梦 2021-01-12 03:41

Im looking to use php mailers debug information to display in a webpage. When I enable debugging it just echo\'s the string. This means that my html is out of order, I wish

相关标签:
1条回答
  • 2021-01-12 04:09

    A recent change in PHPMailer allows Debugoutput to be a closure, so you can make it do whatever you like, for example to collect all the debug output and emit it later:

    $debug = '';
    $mail->Debugoutput = function($str, $level) {
        $GLOBALS['debug'] .= "$level: $str\n";
    };
    //...later
    echo $debug;
    
    0 讨论(0)
提交回复
热议问题