mail
mail copied to clipboard
Ability to load images in signatures
Feature Request
The ability for signatures for each account to have images is a common feature in most email clients.
Summary
The ability for signatures for each account to have images is a common feature in most email clients.
As an example:

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
As briefly discussed in the dev channel, we need a permanent storage for these images. And then transform them into attachments when the messages is sent.
As a step in between we could start with external images only. This isn't ideal. But for some cases like corporate logos, this might actually just do the job.
Another thing that we could do is use ckeditor's base64 "storage". Of course this bloats messages, but for small images (like, again, logos) this could be fine. Maybe worth a consideration? :thinking:
Another thing that we could do is use ckeditor's base64 "storage". Of course this bloats messages, but for small images (like, again, logos) this could be fine. Maybe worth a consideration? 🤔
Good idea! What makes this more appealing is the fact that typically people stray away form large signatures as loading them becomes a pain if they are too large. So one could always specify a size limit?
So one could always specify a size limit?
Absolutely!
Would it make sense to have an interim solution where the image is hosted on a third-party site like imgur.com, and have the URL pasted in the signature so that it shows up and "looks like" the image is added to the signature itself? Something similar to what google is allowing in it's gmail settings? Just until you have figured out the way forward into making it a clean integration to core code?
We could allow external images already, I think.
It's basically what I meant to explain with
As a step in between we could start with external images only. This isn't ideal. But for some cases like corporate logos, this might actually just do the job.
The app wouldn't need to care where the images are stored. We'd just need to find a way to not make the browser block these images with our strict CSP.
If you could allow them already, it would go a long way for users! I understood what you meant, just wanted clarification. Because we could create an image with all the details normally found in the signature, like the example @JohnMaree posted in the OP, and just link that in there.
I tried adding images a while back (like 3 weeks or so) and it was not working, but might be that one needs a specific syntax for the mail client/editor to understand this imported image?
@ChristophWurst sorry but you closed the issue, but there is no solution provided. You said it's already possible to insert third-party image but you didn't explain the way to do it. There is no visible way in the UI.
The exchange below sound quite strange. Why we should use third-party site to embed pictures in an app designed to work in context of storing and sharing content software ???
Why we can join picture as attachment but not inside the body ? Nextcloud Sharing Path App already deliver a way for Nextcloud to act as CDN. This process may apply to a specific folder dedicated to mail content.
@ChristophWurst sorry but you closed the issue, but there is no solution provided. You said it's already possible to insert third-party image but you didn't explain the way to do it. There is no visible way in the UI.
I never claimed that. Read my comment again. It just states that your feature request is a duplicate and we have an existing ticket for discussion.
The exchange below sound quite strange. Why we should use third-party site to embed pictures in an app designed to work in context of storing and sharing content software ???
Please carefully read the previous discussion. We want to have this, but it's not easy. So we would start small and add more advanced options gradually. But please change my mind and submit a pull request with the implementation.
We could allow external images already, I think.
@ChristophWurst sorry but I made tow mistake 1 - I understood the sentence below as it's something already possible. I may was too much enthousiast ;) 2 - I thought you closed this issue not only the one i opened as duplicate :-( Hope you will find a way. have a nice day :)
Hello, but actually for Nextcloud you can use the cloud as temp storage, or the user can upload the Image into his cloud and use the public link. <--- This is Just as an idea.
As a step in between we could start with external images only. This isn't ideal. But for some cases like corporate logos, this might actually just do the job.
I'm looking into this right now. Adding the CKEditor plugin is easy. BUT you won't see the image when you compose the email as Nextcloud's strict CSP will block the image URL on the Nextcloud page.
I think we'll start with the base64 insert option and the external hosting will follow later.
Another thing that we could do is use ckeditor's base64 "storage". Of course this bloats messages, but for small images (like, again, logos) this could be fine. Maybe worth a consideration?
So I did that
I think we'll start with the base64 insert option and the external hosting will follow later.
But turns out this is creating more problems than it solves. It's fairly simple to add base64 images to CKEditor, but our own client can't view those messages. Turns out we're not doing it wrong, but security practice typically forbids data sources for images in email.
Some references
- Overview of email clients that can handle it https://stackoverflow.com/questions/13049453/how-to-successfully-embed-images-in-html-for-display-in-webmail-clients
- Source of the image from above https://www.campaignmonitor.com/blog/how-to/2008/08/embedding-images-in-email/
- More proof that most (web) apps block these sources https://blog.mailtrap.io/embedding-images-in-html-email-have-the-rules-changed/#Inline_embedding_or_base64_images_in_emails
So I'm concluding that this really isn't worth the effort. Let's rather have proper support for inline images that are sent as attachment. We can hopefully re-use some of our existing logic for this. Then a custom ckeditor uploader can wire the editor with our attachments: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/upload-adapter.html
Images as attachments doesn't solve the problem with signatures. For signatures we'll still need that special storage. This will be the most complex aspect of the whole feature.
Probably a dumb comment, but while exploring the Nextcloud filesystem, I see that the data folder contains sub-folders, some of them are dedicated to apps, for instance ownbackup, rainloop-storage, why not mail for signature images ?
The Deck app can also upload a file to a card that resides under data-[instanceId]/deck/file-car-[id]/
There are also very good support for all desktop mail client, and if I have people wanting to send email from their phone, using the web interface of nextcloud, it would be ideal if the person could insert the signature that he/she desire and not be coerced with some limitation because of how the mail client display message. The displaying of message and the sending of message should be totally separate in terms of managing the images... Also, normally some mail clients will detect if the images are linked with the same address that the mail server itself, the image will show otherwise simply offer a option to hide all image and only load them on demand. (antispam, image tracking, etc). IMO, you are trying to manage something that should be the job of the end client to choose and decide and that forcing people to only use Text or CKEditor is really a bad decision that prevent SMB from adopting nextcloud, I for one have at least 2 that won't switch just because of this. But like I already mentioned I will try to find time, somehow, to read the docs and try to find a way to make the modification
All others client I know allow real signature, think about squirrel mail, roundcube, etc.
Just my 2 cents
Hi, any news regarding this?
It is gonna be great if we can set a template for the signature for every use, e.g.:
Best regards,
Title Firstname Lastname
Company Name
Logo Image
Hi, any news regarding this?
The ticket is still open and there was not a single comment indicating that anyone works on this … so … no.
Hi, any news regarding this?
The ticket is still open and there was not a single comment indicating that anyone works on this … so … no.
Ok thanks, I just wanted to add my thoughts to this (namely the template the template).
Hi all,
What's the status of simply allowing a plain and dumb "img src" support, where the user fills in the image's URL?
Such a simple feature would solve our current issue (and maybe also that of many other organizations), i.e. being able to add a HTML signature with an image where the link is somewhere in the same domain as our mail address and our NC instance. No need for NC to do any further processing other than perhaps some kind of malicious code injection checks.
Thanks in advance and kind regards!
See the previous comments. Unfortunately there is nothing "simple" about this.
But feel free to experiment with it and you'll see for yourself. The CSP will block those external images.
@ChristophWurst do you have any idea how the other products are doing it? For example in the company I am working for, they have an image in the signature, but I have no idea how (they use Exchange as a server I believe, as a client, they have some webinterface, I guess it is the typical Microsoft 365 interface, and also the same signature with an image is synchronized with Outlook for desktop). If you can give me a clue, I may support in this, I am not sure if I will have time to implement it, but at least I can give a bit more detailed information about it.
I think you have to proxy the image through the server, so that there is no external domain for the image. And then when the message is sent you have to rewrite the HTML to change the href from pointing to the proxy to the target URL.
I have been thinking about it, @ChristophWurst.
Is it possible somehow simply to add the image manually to the signature of all users, I mean just to use a default standard signature for all users (by editing some file, to add image to all users or something like this)? Because initially I would like to test it in case the mail server is hosted on the same server like Nextcloud, with the same domain, namely no cross-origin issues. I am asking because I will be trying it today evening, I am just trying to gether the information now to be able to start testing asap.
@MohammedNoureldin based on what @ChristophWurst replied to me, that option would still trigger the CSP nonetheless. If I understood it correctly, NC team is working on a simple but possibily CSP-safe method of setting up a signature. Actually I'm already having that issue with my HTML signature, even if the image is hosted under the same domain, you have to tell your mail client to load the remote content images in order for you to see the signature correctly. Hope this helps. Cheers, Marco
Thank you for your reply, @marcotrevisan.
I didn't undestand what you mean by this scentence:
you have to tell your mail client to load the remote content images
Isn't it just including a <img> HTML code? Could you please tell me a bit more about it?
I don't think it is in-work at the moment (according to what Christoph wrote above).
I mean, my Thunderbird by default won't load remote content (i.e. image tags referencing to a remote server location) so I have to click on the "show remote content" action to see the complete HTML rendering.
@marcotrevisan, but I still don't understand how the "correct" way should be? In other words how the others are doing it? For example when I send email from my Gmail (even from my desktop client), the images are shown correctly.
What do they do to get it working out of the box? Do you have any idea about it?
Thanks
I think you have to proxy the image through the server, so that there is no external domain for the image. And then when the message is sent you have to rewrite the HTML to change the href from pointing to the proxy to the target URL.
This and only this.
Please, give this a try. Or do it the way you think works and see that it doesn't.
If you have any development questions use https://help.nextcloud.com/c/dev/app-dev/24. This is an issue tracker.
@marcotrevisan, but I still don't understand how the "correct" way should be? In other words how the others are doing it? For example when I send email from my Gmail (even from my desktop client), the images are shown correctly.
What do they do to get it working out of the box? Do you have any idea about it?
That's actually really easy (to say) - namely they bundle every single referenced thing (especially pictures) with the email as separate multipart/mixed content (this was shown and discussed somewhere in this thread and/or the linked resources from/to this thread). Second, MUAs are highly constrained when it comes to CSS (and of course html itself, but that's easy to overcome with generic tags and styles). Basically the rule is to inline all styles (as global styles won't work) and test it on non-recent iPhone (that's probably the most constrained of all MUAs) and in the GMail web email interface (which is IMHO the second most constrained one).
But it's not easy to implement & test in terms of manhours needed if you think of it...
@ChristophWurst sorry but I still don't get the second part of your explanation. However, the general idea is clear to me now. And as it is not really pleasant to have development discussions here let us not continue in it.
I just want to add this link as it mentions the basic approaches to send images in emails (basically as explained above, but a bit more organized and colored), maybe this can help somebody. https://www.mail-signatures.com/articles/images-in-email-signatures-linked-or-embedded/?sts=5255