• Resolved codenitive

    (@gswebdev)


    Hello,

    I’m getting the following PHP warning on my site when using the FluentSMTP plugin:


    PHP Warning: Undefined property: PHPMailer\PHPMailer\PHPMailer::$contentType in /home/myweb/public_html/wp-content/plugins/fluent-smtp/app/Services/Mailer/Providers/PepiPost/Handler.php on line 160

    This warning seems to be related to $phpMailer->contentType which may not be a defined property in the current PHPMailer version.

    Environment details:

    • WordPress version: 6.8.2
    • PHP version: 8.2
    • FluentSMTP version: 2.2.92

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m not affiliated with FluentSMTP, but I do use it quite a bit. From what you’ve shared, it looks like the code in question is trying to access a content type, but it hasn’t been set. PHPMailer itself does still support ContentType (it hasn’t been deprecated and will never be, it’s essential functionality).

    Normally, the content-type should be defined either by the plugin sending the email, or by your code if you’re calling wp_mail($to, $subject, $body, $headers) directly.

    If you yourself are writing the code to send the emails with wp_mail, make sure you pass a header with a content type, something like:

                    $headers = array(
    'Content-Type: text/html; charset=UTF-8',
    'From: YOUR EMAIL',
    );

    If you’re not writing the mail sending code, then the plugin should be taking care of this. In that case, the warning does indicate a bug or missing property in FluentSMTP, or the plugin you’re sending emails with, for PepiPost. I’d suggest continuing to wait on a response from FluentSMTP or the other plugin if so.

    Hope this helps!

    • This reply was modified 7 months, 1 week ago by annaam. Reason: clarity
    Plugin Support Ibrahim Sharif

    (@ibrahimsharif)

    Hello @gswebdev,

    The key suggestion from @annaam is to ensure that a Content-Type header is passed along when sending emails, particularly if you are initiating emails via wp_mail() from your custom code. A common way to do this is by including a header like this:

    $headers = array(
        'Content-Type: text/html; charset=UTF-8',
        'From: YOUR EMAIL',
    );
    // Example: wp_mail($to, $subject, $body, $headers);
    

    Following the guidance we’ve received, we would be very grateful if you could confirm if applying this fix, as kindly suggested by @annaam, has resolved the warning for you.

    If you are not directly writing the code to send emails yourself, and another plugin or FluentSMTP’s internal PepiPost handler is responsible for setting the ContentType, then your detailed environment information (WordPress 6.8.2, PHP 8.2, FluentSMTP 2.2.92) will be invaluable. If the suggested fix doesn’t resolve the warning, it would indicate that we need to investigate how the ContentType is being handled specifically within the FluentSMTP PepiPost integration.

    Please let us know the outcome of trying this suggestion.

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

You must be logged in to reply to this topic.