[GH-ISSUE #391] img tag is stripped in anchor tag #323

Open
opened 2026-02-25 21:34:45 +03:00 by kerem · 11 comments
Owner

Originally created by @lysaan on GitHub (Apr 23, 2020).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/391

Originally assigned to: @jasonmunro on GitHub.

Hi Greetings, I hope you are doing well.
Cypht is very useful for email handling. We would like to thanks you guys for this awesome software.
We are facing an issue and I am sure together we can solve this.
When we get images in outlook, it is different once it gets opened in Cypht:
and are there, but is really stripped. Also tag missed target attribute in Cypht…

Outlook source:
<a href="https://xyz.us1.list-manage.com/track/click?u=acea05dea746a229d48d94d2d&amp;id=e51bc25443&amp;e=aa1bbf616b" target="_blank"> <span style='text-decoration:none'> <img border=0 width=562 style='width:5.8541in' id="_x0000_i1027" src="https://mcusercontent.com/acea746a229d48d94d2d/images/a4a81466-66fc-488c-8c89-0c189ae7938e.png"> </span></a>

Cypht source:
<a href="https://xyz.us1.list-manage.com/track/click?u=acea0ea746a229d48d94d2d&amp;id=e51bc25443&amp;e=aa1bbf616b"> <span style="text-decoration:none;"> </span> </a>

Originally created by @lysaan on GitHub (Apr 23, 2020). Original GitHub issue: https://github.com/cypht-org/cypht/issues/391 Originally assigned to: @jasonmunro on GitHub. Hi Greetings, I hope you are doing well. Cypht is very useful for email handling. We would like to thanks you guys for this awesome software. We are facing an issue and I am sure together we can solve this. When we get images in outlook, it is different once it gets opened in Cypht: <a> and <span> are there, but <img> is really stripped. Also <a> tag missed target attribute in Cypht… Outlook source: `<a href="https://xyz.us1.list-manage.com/track/click?u=acea05dea746a229d48d94d2d&amp;id=e51bc25443&amp;e=aa1bbf616b" target="_blank"> <span style='text-decoration:none'> <img border=0 width=562 style='width:5.8541in' id="_x0000_i1027" src="https://mcusercontent.com/acea746a229d48d94d2d/images/a4a81466-66fc-488c-8c89-0c189ae7938e.png"> </span></a>` Cypht source: `<a href="https://xyz.us1.list-manage.com/track/click?u=acea0ea746a229d48d94d2d&amp;id=e51bc25443&amp;e=aa1bbf616b"> <span style="text-decoration:none;"> </span> </a>`
Author
Owner

@jasonmunro commented on GitHub (May 4, 2020):

Hi @lysaan thanks for the feedback. This is by design. Cypht is very careful with HTML formatted E-mail, especially external content. Allowing external images in an HTML message is a privacy and possible security risk, so along with a bunch of other bits we strip out of HTML messages, external images are also by default removed.

It is possible to view external images, however it's an opt-in per message and you have to change your site configuration. From the hm3.sample.ini:

; Allow remote image sources
; --------------------------
;
; WARNING: Using this feature could leak information to external sources.
;
; By default Cypht will not allow external images to be loaded when viewing an
; HTML formatted E-mail message. A Content Security Policy header limits images
; sources to "self" only and the message content is filtered to remove any external
; resource. If you really want the ability to view external images in an E-mail,
; first you need to change the following setting to true. When viewing a HTML
; formatted message you will now have a link before the message body called "Allow
; Images" that will reload the message part with external images visible.
allow_external_image_sources=false

Remember you need to rerun config_gen.php anytime you change your hm3.ini file.
Hope that helps!

<!-- gh-comment-id:623267314 --> @jasonmunro commented on GitHub (May 4, 2020): Hi @lysaan thanks for the feedback. This is by design. Cypht is very careful with HTML formatted E-mail, especially external content. Allowing external images in an HTML message is a privacy and possible security risk, so along with a bunch of other bits we strip out of HTML messages, external images are also by default removed. It is possible to view external images, however it's an opt-in per message and you have to change your site configuration. From the hm3.sample.ini: > ; Allow remote image sources > ; -------------------------- > ; > ; WARNING: Using this feature could leak information to external sources. > ; > ; By default Cypht will not allow external images to be loaded when viewing an > ; HTML formatted E-mail message. A Content Security Policy header limits images > ; sources to "self" only and the message content is filtered to remove any external > ; resource. If you really want the ability to view external images in an E-mail, > ; first you need to change the following setting to true. When viewing a HTML > ; formatted message you will now have a link before the message body called "Allow > ; Images" that will reload the message part with external images visible. > allow_external_image_sources=false Remember you need to rerun config_gen.php anytime you change your hm3.ini file. Hope that helps!
Author
Owner

@marclaporte commented on GitHub (Oct 22, 2020):

Related: https://github.com/jasonmunro/cypht/issues/269

<!-- gh-comment-id:714783838 --> @marclaporte commented on GitHub (Oct 22, 2020): Related: https://github.com/jasonmunro/cypht/issues/269
Author
Owner

@red3333 commented on GitHub (Oct 27, 2020):

I have set allow_external_image_sources=false, re-run config_gen.php, restarted the server.
Now I can see a button in the mail preview : "Allow Images"
But when I click on it, the message reloads, but still no image...
Am I missing something else ?

<!-- gh-comment-id:717245367 --> @red3333 commented on GitHub (Oct 27, 2020): I have set allow_external_image_sources=false, re-run config_gen.php, restarted the server. Now I can see a button in the mail preview : "Allow Images" But when I click on it, the message reloads, but still no image... Am I missing something else ?
Author
Owner

@jasonmunro commented on GitHub (Oct 28, 2020):

@red3333 sounds like you got it covered, so either the message is broken somehow or there may be a new bug with showing inline images that I'm not aware of. Have you tried multiple messages with the same result?

<!-- gh-comment-id:717680081 --> @jasonmunro commented on GitHub (Oct 28, 2020): @red3333 sounds like you got it covered, so either the message is broken somehow or there may be a new bug with showing inline images that I'm not aware of. Have you tried multiple messages with the same result?
Author
Owner

@red3333 commented on GitHub (Oct 28, 2020):

Yes, it is the same with many other messages.
As described @lysaan , the img tag is just missing (empty line instead of tag).

<!-- gh-comment-id:717780210 --> @red3333 commented on GitHub (Oct 28, 2020): Yes, it is the same with many other messages. As described @lysaan , the img tag is just missing (empty line instead of tag).
Author
Owner

@marclaporte commented on GitHub (Jul 31, 2022):

@red3333 @lysaan Any chance you could pop over into https://gitter.im/cypht-org/community and we try to find a solution together?

<!-- gh-comment-id:1200484679 --> @marclaporte commented on GitHub (Jul 31, 2022): @red3333 @lysaan Any chance you could pop over into https://gitter.im/cypht-org/community and we try to find a solution together?
Author
Owner

@marclaporte commented on GitHub (Jan 11, 2024):

@red3333 @lysaan please

<!-- gh-comment-id:1887121467 --> @marclaporte commented on GitHub (Jan 11, 2024): @red3333 @lysaan please
Author
Owner

@marclaporte commented on GitHub (Jan 11, 2024):

Related: https://github.com/cypht-org/cypht/issues/861

<!-- gh-comment-id:1887274207 --> @marclaporte commented on GitHub (Jan 11, 2024): Related: https://github.com/cypht-org/cypht/issues/861
Author
Owner

@marclaporte commented on GitHub (May 7, 2024):

@lysaan

Please retest, as a lot has changed since you reported this issue. Notably, we now have 3 active branches and recently released Cypht 2.0.0

<!-- gh-comment-id:2097123352 --> @marclaporte commented on GitHub (May 7, 2024): @lysaan Please retest, as a lot has changed since you reported this issue. Notably, we now have 3 active branches and recently released Cypht 2.0.0 - https://github.com/cypht-org/cypht/releases/tag/v2.0.0 - https://github.com/cypht-org/cypht/wiki/Lifecycle
Author
Owner

@marclaporte commented on GitHub (Sep 14, 2025):

@lysaan We are now at version 2.4.2 and soon 2.5.0

Any chance you could retest?

Thanks!

<!-- gh-comment-id:3289067728 --> @marclaporte commented on GitHub (Sep 14, 2025): @lysaan We are now at version 2.4.2 and soon 2.5.0 Any chance you could retest? Thanks!
Author
Owner

@lysaan commented on GitHub (Sep 14, 2025):

Hi @marclaporte , thanks for the update.
I hope it will solve the issue, but due to my other commitments, I won't be able to test it out.

Regards

<!-- gh-comment-id:3289315964 --> @lysaan commented on GitHub (Sep 14, 2025): Hi @marclaporte , thanks for the update. I hope it will solve the issue, but due to my other commitments, I won't be able to test it out. Regards
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/cypht#323
No description provided.