nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
840 stars 260 forks source link

Ability to load images in signatures #2733

Closed JohnMaree closed 2 years ago

JohnMaree commented 4 years ago

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: compact-logo-1

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/89722404-ability-to-load-images-in-signatures?utm_campaign=plugin&utm_content=tracker%2F44154351&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F44154351&utm_medium=issues&utm_source=github).
ChristophWurst commented 4 years ago

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.

ChristophWurst commented 4 years ago

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:

JohnMaree commented 4 years ago

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?

ChristophWurst commented 4 years ago

So one could always specify a size limit?

Absolutely!

hanserasmus commented 4 years ago

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?

ChristophWurst commented 4 years ago

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.

hanserasmus commented 4 years ago

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?

CATER-COM commented 4 years ago

@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 commented 4 years ago

@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.

CATER-COM commented 4 years ago

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 :)

jvalters commented 4 years ago

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.

ChristophWurst commented 3 years ago

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.

ChristophWurst commented 3 years ago

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

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.

mmallejac commented 3 years ago

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]/

stevearbour commented 3 years ago

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

MohammedNoureldin commented 3 years ago

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
ChristophWurst commented 3 years ago

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.

MohammedNoureldin commented 3 years ago

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).

marcotrevisan commented 3 years ago

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!

ChristophWurst commented 3 years ago

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.

MohammedNoureldin commented 3 years ago

@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.

ChristophWurst commented 3 years ago

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.

MohammedNoureldin commented 3 years ago

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.

marcotrevisan commented 3 years ago

@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

MohammedNoureldin commented 3 years ago

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).

marcotrevisan commented 3 years ago

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.

MohammedNoureldin commented 3 years ago

@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

ChristophWurst commented 3 years ago

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.

dumblob commented 3 years ago

@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...

MohammedNoureldin commented 3 years ago

@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

marcotrevisan commented 2 years ago

Hi all. Is there any progress on this issue? It would be great to have a way to replicate my "html signature" in Thunderbird, bad or problematic as it can be... Roundcube for example already includes a "html signature" support. Thanks

ChristophWurst commented 2 years ago

There is no progress as you can see. The technical barriers are still there.

stevearbour commented 2 years ago

Lol... years later, you can clearly see why we haven't implemented or even attempted at implement next cloud/mail seriously and that for any web base email client, we went with roundcube. And it is important to note, I am myself a developer, but when we felt what was the general attitude here, following this whole post, and when facing a simple request, such as "Please let us NOT use your deficient rich text editor, and add a simple checkbox to allow us to do that on a user basis" turned into a "super complex and super biased" and turned into a "debate" discussion and into a "if you are not happy, pay us $ or do it yourself" instead of "we'll do it when we have a chance",

Aka: Every single little things that could be found and used as a excuse, was used to divert the attention to the real problem and the real solutions. ALL emails clients, including most web based one, allow for HTML signature, and it is up to the user (not the developer) to decide between the catch 22 of embedded base 64 encoded image, or image hosted on the email server itself, etc. Someone clearly need to read a bit about strip_tags and filter_input PHP method, and learn about them...

Also, about the client not allowing embedded image per default, ALL emails clients already do that, and they maintain a internal list of which address you have allowed to view remote images, outlook, thunderbird, etc. This is not black magic or sorcery, it is pure and plain logic 101. It could also be require that someone be in your addressbook to allow to load embedded or remote images, but anyhow.

Since next cloud is a multi platform and so big and way way much more complex that just "this", not only we felt that going into next cloud we would be shooting ourselves in the foot to start with, but it clearly justified all the trouble to deal with microsoft/thunderbird+caldav/roundcube scenario. It is a great solution for mom and pop who are a little into computer, but the minute your an actual business (no matter what is the size), this is ain't serious. So sorry for the other part of next cloud, it seemed a nice project, but the Mail section of the NC project is toxic in my opinion.

Have a nice day.

foxhoundv commented 2 years ago

Hello, so I think this is a really good idea to have and as I scanned through the previous comments I thought of a couple ways that maybe this could be implemented. I am not a programmer so just giving some ideas...

  1. Reference a shared image on the Nextcloud instance that doesn't need special access. I'm guessing that <img src> would be the way to accomplish this and I did read that it isn't easy, just throwing out an idea.
  2. Setting --> Mail page that allows uploading of an image source or file?

If I missed any of these in the discussion I'm sorry, I tried to find if there were any similar postings.

jvalters commented 1 year ago

Hello, is there any movement on this?

Thanks

renatolinux commented 1 year ago

NextCloud devs should pay attention to this request. I’ve already accessed all the topics, including this one, also without solution. I believe that such a feature should be implemented on the platform, as it is a basic feature that many people need, especially when it comes to the use of internal compliance by companies.

kesselb commented 1 year ago

Welcome on GitHub @renatolinux :wave:

Please take some time to familiarize yourself with GitHub. Your favorite search engine may help you find matching articles.

image

An issue is open or closed. Closed + Fixed by means, in most cases, that a feature was implemented. Fixed by is the reference for the pull request that implemented the feature. It's possible to add images in signatures since Mail 2.0.

NextCloud devs should pay attention to this request.

"should pay attention" sounds very demanding. Please use it carefully, especially on GitHub.