Problem/Motivation

My configurations:
- Drupal 10.0.7
- PHP 8.1.13
- Mimemail 8.x-1.0-alpha5

There is deprecated code in src/Utility/MimeMailFormatHelper.php. (line 452 and line 685).
https://www.drupal.org/node/3126004

This prevent the email from being sent. The module works when I replace the lines with guessMimeType().

Error: Call to undefined method Drupal\Core\ProxyClass\File\MimeType\MimeTypeGuesser::guess() in Drupal\mimemail\Utility\MimeMailFormatHelper::mimeMailFile() (line 452 of /web/modules/contrib/mimemail/src/Utility/MimeMailFormatHelper.php).

Proposed resolution

guess() needs to be replaced by guessMimeType()

CommentFileSizeAuthor
#4 3354721.patch2.37 KBmkalkbrenner

Comments

mlanteigne created an issue. See original summary.

tr’s picture

Status: Active » Closed (duplicate)
mkalkbrenner’s picture

Title: MimeTypeGuesser::guess() is deprecated » MimeTypeGuesser::guess() is deprecated, fatal errors with Drupal 10.0 and 10.1
Priority: Major » Critical
Status: Closed (duplicate) » Active

I understand that this issue should be fixed together with #3155325: Improve image detection.
But that issue is not solved since months. So mimemail causes PHP fatal errors on Drupal 10.0 and 10.1 while it pretends to be compatible to Drupal ^10.
Therefore, I suggest to fix that fatal error first.

mkalkbrenner’s picture

Status: Active » Needs review
StatusFileSize
new2.37 KB
tr’s picture

Title: MimeTypeGuesser::guess() is deprecated, fatal errors with Drupal 10.0 and 10.1 » MimeTypeGuesser::guess() is deprecated
Priority: Critical » Major
Status: Needs review » Closed (duplicate)

So help solve that issue. Part of the problem is that there is not sufficient testing, which is why that other issue needs to be fixed and which is why a band-aid like you propose is not a sustainable solution for this module going forward.

leducdubleuet’s picture

@mkalkbrenner
Thanks a lot for the band-aid in comment #4, it helps going forward while the other issue is worked on!

@TR
I'll have a look at that other issue to see if I can help.

leducdubleuet’s picture

@TR
I understand that you want it clean with the testing and all but Drupal 9 is not supported anymore and we really need a functional D10 version of this module. It has been more than 8 months and no work has been done on the other issue #3155325: Improve image detection...

So I am asking if it would it be possible to release a D10 version even if the band-aid solution is not ideal please?

mkalkbrenner’s picture

Title: MimeTypeGuesser::guess() is deprecated » MimeTypeGuesser::guess() is deprecated, D10 compatibility
Version: 8.x-1.0-alpha5 » 8.x-1.x-dev
Priority: Major » Critical
Status: Closed (duplicate) » Needs review

I totally agree with @LeDucDuBleuet

I re-open this issue to help others, because Drupal 9 reached EOL.
I also set the priority back to Critical, because mails aren't sent.

tido’s picture

Can you tell me if this issue will soon be included in the release?

I can confirm that sending emails with an attachment provided in #attachments fails if this patch is not present with Drupal 10.2.2 / PHP 8.2 / Mimemail 8.x-1.0-alpha6.

leducdubleuet’s picture

Status: Needs review » Reviewed & tested by the community

This patch has been tested successfully for more than 6 months now on many websites, I can confirm it is RTBC.

@TR
It has been more than a year now, while not ideal, could we have a new release including this patch please?

Thank you very much.

leducdubleuet’s picture

Would it be possible to have this patch committed to 8.x-1.x-dev please?

  • mark_fullmer committed 679925a0 on 2.0.x
    [#3354721] feat: MimeTypeGuesser::guess() is deprecated, D10...
mark_fullmer’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, everyone! This has been committed and will be included in the upcoming 2.0.0-alpha2 release.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.