[GH-ISSUE #388] Error : importing external CSS styles #253

Closed
opened 2026-03-15 13:28:07 +03:00 by kerem · 6 comments
Owner

Originally created by @maximovj on GitHub (Nov 16, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/388

Error : importing external CSS styles

I am working with HTML and Bootstrap v5 to send an email and display Bootstrap v5 CSS styles, but mailpit cannot load the Bootstrap styles correctly. The same issue occurs with emails sent from Laravel.

In the HTML Source tab, I can see the code in more detail, but in the HTML tab, the Bootstrap 5 styles are not applied correctly. I have tried adding the --block-remote-css-and-fonts flag as per the official documentation to fix the issue, but the problem persists.

This is the tab: HTML Source
image

This is the tab: HTML Source
image

This is the expected result:
image

Originally created by @maximovj on GitHub (Nov 16, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/388 # Error : importing external CSS styles I am working with HTML and Bootstrap v5 to send an email and display Bootstrap v5 CSS styles, but `mailpit` cannot load the Bootstrap styles correctly. The same issue occurs with emails sent from Laravel. In the HTML Source tab, I can see the code in more detail, but in the HTML tab, the Bootstrap 5 styles are not applied correctly. I have tried adding the --block-remote-css-and-fonts flag as per the official documentation to fix the issue, but the problem persists. This is the tab: HTML Source ![image](https://github.com/user-attachments/assets/210b9ad7-65d9-477a-85e6-08d7e06db4d5) This is the tab: HTML Source ![image](https://github.com/user-attachments/assets/52a02c1e-d98f-4495-bdca-d3565304549d) This is the expected result: ![image](https://github.com/user-attachments/assets/e207c005-4fc3-45b6-a707-25150a96b1cc)
kerem 2026-03-15 13:28:07 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@axllent commented on GitHub (Nov 16, 2024):

It should be working as-is because remote CSS is not blocked by default. Can you please attach a sample message (which I can feed into my Mailpit) to test? Thanks.

<!-- gh-comment-id:2480847597 --> @axllent commented on GitHub (Nov 16, 2024): It should be working as-is because remote CSS is not blocked by default. Can you please attach a sample message (which I can feed into my Mailpit) to test? Thanks.
Author
Owner

@maximovj commented on GitHub (Nov 16, 2024):

This is a test message I am making.
message-test.txt

I noticed that this error appears in the browser console, it could be the issue.
image

I am currently using Laravel 8.x and PHP 7.4.33 from Laragon, as shown in the image.
image

I did one last test, now in MailHog, and it works correctly when viewing the HTML.
image

<!-- gh-comment-id:2480855267 --> @maximovj commented on GitHub (Nov 16, 2024): This is a test message I am making. [message-test.txt](https://github.com/user-attachments/files/17788269/message-test.txt) I noticed that this error appears in the browser console, it could be the issue. ![image](https://github.com/user-attachments/assets/d7dbe05a-7a5c-4eb8-838c-c9f332f43e2d) I am currently using Laravel 8.x and PHP 7.4.33 from Laragon, as shown in the image. ![image](https://github.com/user-attachments/assets/bb9aa8d1-7c2c-4973-a104-f49991692f81) I did one last test, now in MailHog, and it works correctly when viewing the HTML. ![image](https://github.com/user-attachments/assets/b1cae3a1-d4ec-4cf0-bc00-8c7dcf328281)
Author
Owner

@axllent commented on GitHub (Nov 17, 2024):

Bug confirmed - leave this with me!

<!-- gh-comment-id:2480892448 --> @axllent commented on GitHub (Nov 17, 2024): Bug confirmed - leave this with me!
Author
Owner

@axllent commented on GitHub (Nov 17, 2024):

Thanks for reporting this bug - it's actually been broken for several months so I'm surprised nobody reported it earlier! The fix has been fixed in v1.21.4. Please let me know if it is working again for you? Thanks.

<!-- gh-comment-id:2480927194 --> @axllent commented on GitHub (Nov 17, 2024): Thanks for reporting this bug - it's actually been broken for several months so I'm surprised nobody reported it earlier! The fix has been fixed in [v1.21.4](https://github.com/axllent/mailpit/releases/tag/v1.21.4). Please let me know if it is working again for you? Thanks.
Author
Owner

@maximovj commented on GitHub (Nov 17, 2024):

I ran two tests using version v1.21.4, and the issue was successfully resolved.
Cool, bro, it works.

This is test number one
image

This is test number two
image

<!-- gh-comment-id:2480932025 --> @maximovj commented on GitHub (Nov 17, 2024): I ran two tests using version [`v1.21.4`](https://github.com/axllent/mailpit/releases/tag/v1.21.4), and the issue was successfully resolved. Cool, bro, it works. This is test number one ![image](https://github.com/user-attachments/assets/ac4518ab-7b18-49d6-9508-faee85f2cd2c) This is test number two ![image](https://github.com/user-attachments/assets/1bcfa3f5-684b-4787-a7b2-35a9acb7764c)
Author
Owner

@axllent commented on GitHub (Nov 17, 2024):

Perfect, thanks for testing and the quick confirmation!

Regarding using external stylesheets (in general), please note that external CSS files is not the recommended approach as popular web clients like Gmail do not support it. And of those that do, most do not support modern CSS like bootstrap (so some features may not work). If you're going to be using it, then keep in mind that there will be a significant portion of users who will not have any styling applied.

I'll close this issue now. Thanks again for reporting it!

<!-- gh-comment-id:2480942873 --> @axllent commented on GitHub (Nov 17, 2024): Perfect, thanks for testing and the quick confirmation! Regarding using external stylesheets (in general), please note that external CSS files is not the recommended approach as popular web clients like Gmail do not support it. And of those that do, most do not support modern CSS like bootstrap (so some features may not work). If you're going to be using it, then keep in mind that there will be a significant portion of users who will not have any styling applied. I'll close this issue now. Thanks again for reporting it!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#253
No description provided.