Ckeditor5 output and absolute URLs for images

Created on 12 November 2024, 5 months ago

Hello,

I am trying to create a custom entity called Newsletter that sends emails to subscribers after the entity is created. I have this basic functionality working, and I think MIME Mail will be helpful for sending HTML emails that an editor can format using CKE5. The problem I am trying to solve now is the inline images from CKE5 seem to have relative URLs in the emails sent by MIME Mail. I haven't been able to figure out a way to change this, and wondering if anyone can point me in the right direction.

I have set $settings['file_public_base_url'] and $settings['file_public_path'], which shows an absolute URL in the web view for the entity, but the emails still seem to show a relative URL.

Thank you

πŸ’¬ Support request
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @srdtwc
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Mime Mail is supposed to convert all URLs to absolute, but that functionality isn't fully working in the 8.x-1.x branch.

  • πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

    Thanks. I was able to work around this limitation using transformRootRelativeUrlsToAbsolute in my module.

    $absolute_body = Html::transformRootRelativeUrlsToAbsolute($body , \Drupal::request()->getSchemeAndHttpHost());
    
Production build 0.71.5 2024