downloadEmail error on Save

4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: 7 hours ago   (RSS)

I have just installed downloadEmail plugin fir first time. Its purpose for this site is to allow us to create a section editor based upon the _incoming_mail table from which site users can access submitted email content.

It works fine in that regard.

However, I would like to control postings going live on the site until an admin has ruled them publish-worthy. As I have often done for other similar situations, I created a "Publish" checkbox in the _incoming_mail table so that my query can limit results to only those set to publish. However, when I check the "Publish" box and attempt to save the record, I receive a forbidden error, (see attachment).

Is the _incoming_mail table configured in such a way as to disallow what I am trying to do?

Thanks.

Attachments:

CMSBError.webp 40K

I have encountered a new error with downloadEmail plugin.

After configuration, it worked well for a day or so. However, that was soon replaced by its downloading messages more than a dozen times.

After that, it has been failing each time, retrieving nothing and generating the error:

_mb_is_valid_encoding(): Argument #1 ($encoding) must be of type string, null given, called in /chroot/home/avisitwj/avisitwithjesus.com/html/cmsCSoft/plugins/downloadMail/downloadMail.php on line 473.

The full error message received by email is:

The following Scheduled Task did not complete successfully:

Date/Time: 2024-08-25 11:00:01Activity: Download MailSummary: Returned errorsCompleted: 0Function: downloadMail_startTaskOutput: Checking mail account: xxxxxxxx@example.com
Connecting to IMAP host: cloudvpstemplate.xxxx.example.com
Downloading 4 of 4 new messages
Downloading message #1 - UID: 102 - Message-Id: <945705112.1573113.1724580058952@nvirginia-se-email-delivery-5f58bbb4b8-phlbn>
_mb_is_valid_encoding(): Argument #1 ($encoding) must be of type string, null given, called in /chroot/home/user/example.com/html/cmsCSoft/plugins/downloadMail/downloadMail.php on line 473 in /chroot/home/user/example.com/html/cmsCSoft/plugins/downloadMail/downloadMail.php on line 473

Line 473 references the function...

472     function _mb_convert_to_utf8($string, $fromEncoding, $defaultEncoding = 'UTF-8') {
473.    $encoding = _mb_is_valid_encoding($fromEncoding) ? $fromEncoding : $defaultEncoding;
474.     return mb_convert_encoding($string, 'UTF-8', $encoding);
            }

Has anyone else encountered this behavior?

Hello pgplast,

Sorry I hadn't seen this sooner. Hopefully you got this resolved on your own, but if not I have a fix for you. The bug you encountered is something I have seen in another project using download mail so thought I would provide a fix below for anyone else who may encounter the problem inside the download mail plugin...

function _mb_convert_to_utf8($string, $fromEncoding, $defaultEncoding = 'UTF-8') {
  $encoding = (!is_null($fromEncoding) && _mb_is_valid_encoding($fromEncoding)) ? $fromEncoding : $defaultEncoding;
  return mb_convert_encoding($string, 'UTF-8', $encoding);
}

The error occurs due to the $fromEncoding sometimes being null. Here we check for it. If it is null, we will use the default encoding (UTF-8). 

Before implementing, be sure to backup your plugin. Keep in mind that this fix will get overwritten if you choose to update the plugin. I will have Dave put it in the next official release of the plugin.

Thanks again for the report!

Tim Hurd
Senior Web Programmer
Interactivetools.com