• Resolved Sofyan Sitorus

    (@sofyansitorus)


    Hi,

    I found bug for version 1.5.6, as follow:

    Error Severity: 8, Error Message: Undefined variable: content_type, Error File: wp-content/plugins/mailgun/includes/wp-mail.php, Error Line: 284″

    The fix it so simple, you just need to move the code block

    // Allow external content type filter to function normally
    if (has_filter(‘wp_mail_content_type’)) {
    $content_type = apply_filters(
    ‘wp_mail_content_type’,
    $content_type
    );
    }

    right under block

    // If we are not given a Content-Type from the supplied headers, use
    // text/html and *attempt* to strip tags and provide a text/plain
    // version.
    if (!isset($content_type)) {
    // Try to figure out the content type with mime_content_type.
    $tmppath = tempnam(sys_get_temp_dir(), ‘mg’);
    $tmp = fopen($tmppath, ‘w+’);

    fwrite($tmp, $message);
    fclose($tmp);

    // Get mime type with mime_content_type
    $content_type = get_mime_content_type($tmppath, ‘text/plain’);

    // Remove the tmpfile
    unlink($tmppath);
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Sofyan Sitorus

    (@sofyansitorus)

    The fixed code should be like this

    // If we are not given a Content-Type from the supplied headers, use
    // text/html and *attempt* to strip tags and provide a text/plain
    // version.
    if (!isset($content_type)) {
    // Try to figure out the content type with mime_content_type.
    $tmppath = tempnam(sys_get_temp_dir(), ‘mg’);
    $tmp = fopen($tmppath, ‘w+’);

    fwrite($tmp, $message);
    fclose($tmp);

    // Get mime type with mime_content_type
    $content_type = get_mime_content_type($tmppath, ‘text/plain’);

    // Remove the tmpfile
    unlink($tmppath);
    }

    // Allow external content type filter to function normally
    if (has_filter(‘wp_mail_content_type’)) {
    $content_type = apply_filters(
    ‘wp_mail_content_type’,
    $content_type
    );
    }

    And this fix will also fix issue: [Resolved] HTML rendered as plaintext in some emails

    Plugin Author Mailgun

    (@mailgun)

    Hey @sofyansitorus, thanks! I’ll get this fixed asap 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Minor bug on version Version 1.5.6’ is closed to new replies.