Images broken in Emails


(Jared Needell) #1

When a user sends an email, the avatar and attachments are broken. Avatars are default with their first name initial being the avatar.


(Jared Needell) #2

So I notice the image links aren’t attached to the emails, it’s just copying the direct URL from my discourse server which is behind a firewall.

Do the emails not actually properly attach? Sounds like I might have to setup S3 if there isn’t any other option.


(Jared Needell) #3

S3 fixed the image links but now the s3 files are publicly accessible

Avatars still aren’t being sent through emails correctly for my discourse which is behind a firewall.

It appears as.

https://ci5.googleusercontent.com/proxy/somelongkey=s0-d-e1-ft#http://discourseserver/user_avatar/discourseserver/user/45/60_1.png


(Jared Needell) #4

Any update on this? Anyone else notice the image links are broken on my last post?


(Michael Downey) #5

If your server is behind a firewall, the only way an email client will be able to load them is if the network connection is able to access the server.

This is the unfortunate reality of HTML email.


(Jared Needell) #6

That’s not try because the links are broken in the emails and I can access the forums from this computer. Google Apps puts some sort of CDN link in front of the image urls and Google can’t talk to my discourse server.

Why isn’t discourse emails setup properly to attach images to emails rather than using links from a server that’s behind a firewall.

If this is something that can’t be fixed by the Discourse team, what are my options? I already moved files to s3, can I setup my server to put avatars in s3 as well?


(Jared Needell) #7

or can we disable Avatars in emails?


(Michael Downey) #8

Because inline images in HTML emails are not sent as attachments, they’re sent as <img src="..."> references that must be addressable network resources. Doing such might be possible (?) but it is by no means would be a standard solution.

Google might have a way to avoid caching in their clients; I’m not sure but some searching would turn up a method if it exists.


(Jared Needell) #9

So switching to S3 will fix the actually files but not the avatars?


(Michael Downey) #10

I would imagine so, but remember, if you’re storing things on S3, those are publicly available, so you should consider the security risk if your internal server hosting something sensitive (particularly topic attachments!).

I think Discourse caches all profile photos, even those served up by Gravatar, so not sure how you could resolve that other than by using a different email client. :slight_smile:


(Jared Needell) #11

Yeah I’m aware of those risks, I’ll have to bring it up with the rest of my team to see if we need to consider killing off file uploads.

There is an option to disable caching uploaded avatars but my issue is the letter avatars that are default. Can discourse provide any insight on disabling avatars in emails or assistance with getting avatars working?


(Michael Downey) #12

Is your external system avatars enabled site setting enabled? I don’t use this myself so can’t say exactly how it works, but I’d assumed that would load the letter-based avatars from some external CDN that Discourse.org runs…


(Michael Downey) #13

A quick Google search came up with this result; which I assume you’ve already read and tried?

"Set up an image URL proxy whitelist"
https://support.google.com/a/answer/3299041?hl=en


(Jared Needell) #14

I actually haven’t, I’ll check this out thanks.

As for the external system, I do have it checked but the URL is still an internal link URL.


(Kane York) #15

Right, by default for self-installs it sets the letter avatar urls to /letter_avatar_proxy which nginx proxies to avatars.discourse.org so that the server IP is revealed instead of all your visitors’. (Though note that the IPs are not stored or logged anyways.)

You can switch by changing the url format to replace /letter_avatar_proxy/ with https://avatars.discourse.org/ .


(Jared Needell) #16

I updated the url format and the avatars in emails are still trying to download the avatar image from my server rather than discourse.


(Jared Needell) #17

The Avatar proxy still doesn’t seem to be working when I change it to avatars.discourse.org


(Jared Needell) #18

If there could be an option to disable the avatars in the emails, that would fix this issue too.


(Jared Needell) #19

Is there an update on this?

It’s annoying that custom avatars uploaded don’t show up in emails since Discourse is behind a firewall.


(Rafael dos Santos Silva) #20

I had a Discourse behind a firewall, but our users emails were behind the same firewall, so everything woked just fine.

You have a peculiar case, where Discourse itself is in a “safe place” but you send this safe content to the internet over e-mails. Looks like a good use case for Secure Email Mode.