Commit e490a493 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4386 (Misc e-mail debugging improvements)

parent 7ecdd449
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ class form_to_email_test_set extends cms_test_case
    public function testFormToEmail()
    {
        global $SITE_INFO;
        if ((isset($SITE_INFO['no_email_output'])) && ($SITE_INFO['no_email_output'] == '1')) {
            $this->assertTrue(false, 'Test will not work if no_email_output is set');
        if ((isset($SITE_INFO['no_email_output'])) && (($SITE_INFO['no_email_output'] == '1') || (!empty($SITE_INFO['redirect_email_output'])))) {
            $this->assertTrue(false, 'Test will not work if no_email_output or redirect_email_output is set');
            return;
        }

+2 −1
Original line number Diff line number Diff line
@@ -226,7 +226,8 @@ function do_access($given_password)
        */
        'no_keep_params' => '<em>Development:</em> Whether to disable support for \'keep_\' params in Composr. You probably don\'t want to disable them!',
        'safe_mode' => '<em>Development:</em> Whether Composr is to be forced into Safe Mode, meaning no custom files will load and most caching will be disabled.',
        'no_email_output' => '<em>Development:</em> Whether emails should never be sent.',
        'no_email_output' => '<em>Development:</em> Whether e-mails should never be sent.',
        'redirect_email_output' => '<em>Development:</em> Alternate e-mail address to route all e-mails.',
        'email_to' => '<em>Development:</em> If you have set up a customised critical error screen (via a <kbd>_critical_error.html</kbd> file and empty <kbd>critical_errors</kbd> directory), and a background e-mailing process, this defines where error e-mails will be sent.',
        'no_ssl' => '<em>Development:</em> Whether to disable SSL (useful for conditionally disabling on development sites without SSL, when running a database with SSL configured)',
        'nodejs_binary_path' => '<em>Development:</em> Provide the path to your installed Node.js binary to use it for compiling .less stylesheets. You will also need to run `npm install less` in your Composr directory to install the NPM module.',
+24 −8
Original line number Diff line number Diff line
@@ -218,15 +218,31 @@ class Hook_addon_registry_core_primary_layout
     */
    public function tpl_preview__mail()
    {
        return array(
            lorem_globalise(do_lorem_template('MAIL', array(
                'CSS' => '',
        $message_raw = comcode_to_tempcode(do_lang('NEW_COMMENT_BODY', lorem_phrase(), lorem_phrase(), array(lorem_phrase(), lorem_paragraph(), placeholder_url(), lorem_phrase(), placeholder_id(), lorem_phrase())));

        require_css('email');

        $map = array(
            'LOGOURL' => placeholder_image_url(),
            'LOGOMAP' => '',
            'LANG' => fallback_lang(),
            'TITLE' => lorem_phrase(),
                'CONTENT' => lorem_paragraph(),
            )), null, '', true)
            'CONTENT' => $message_raw,
        );

        $tpl = do_lorem_template('MAIL', $map);

        $css = css_tempcode(true, false, $tpl->evaluate());
        $_css = $css->evaluate();

        $map += array(
            'CSS' => $_css,
        );

        $tpl2 = $tpl->bind($map, 'MAIL');

        return array(
            lorem_globalise($tpl2, null, '', true)
        );
    }

+7 −1
Original line number Diff line number Diff line
@@ -601,7 +601,13 @@ function mail_wrap($subject_line, $message_raw, $to_email = null, $to_name = nul
        return false;
    }

    if (@$GLOBALS['SITE_INFO']['no_email_output'] === '1') {
    global $SITE_INFO;

    if (!empty($SITE_INFO['redirect_email_output'])) {
        $to_email = array($SITE_INFO['redirect_email_output']);
    }

    if (@$SITE_INFO['no_email_output'] === '1') {
        require_code('files2');
        clean_temporary_mail_attachments($attachments);

+7 −1
Original line number Diff line number Diff line
@@ -51,7 +51,13 @@ function mail_wrap($subject_line, $message_raw, $to_email = null, $to_name = nul
        return false;
    }

    if (@$GLOBALS['SITE_INFO']['no_email_output'] === '1') {
    global $SITE_INFO;

    if (!empty($SITE_INFO['redirect_email_output'])) {
        $to_email = array($SITE_INFO['redirect_email_output']);
    }

    if (@$SITE_INFO['no_email_output'] === '1') {
        require_code('files2');
        clean_temporary_mail_attachments($attachments);

Loading