mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 10:42:57 +00:00
64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
# Email Logo Display Fix
|
|
|
|
## Problem
|
|
Email logos were not displaying correctly. Gmail was proxying images through `ci3.googleusercontent.com`, showing broken URLs like:
|
|
```
|
|
https://ci3.googleusercontent.com/meips/...#http://logoapi.sportcreative.eu/logos/7eacd9f0-bfa0-4928-a9b6-936140168f58?format=svg
|
|
```
|
|
|
|
## Root Causes
|
|
1. **SVG format incompatibility**: SVG images are not well-supported in email clients
|
|
2. **Email client proxying**: Gmail and other email clients proxy external images, which can fail for certain formats
|
|
3. **Poor fallback**: Used non-existent placeholder URL
|
|
|
|
## Solution Implemented
|
|
|
|
### Changes in `pkg/email/service.go`
|
|
Updated all email functions to use PNG format instead of SVG:
|
|
|
|
**Before:**
|
|
```go
|
|
clubLogo = fmt.Sprintf("https://logoapi.sportcreative.eu/logos/%s?format=svg", clubID)
|
|
```
|
|
|
|
**After:**
|
|
```go
|
|
// Use PNG format for better email client compatibility (SVG not widely supported)
|
|
clubLogo = fmt.Sprintf("https://logoapi.sportcreative.eu/logos/%s?format=png&width=400", clubID)
|
|
```
|
|
|
|
### Affected Functions
|
|
1. ✅ `SendAdminWelcome()` - Line 86
|
|
2. ✅ `SendPasswordResetCode()` - Line 237
|
|
3. ✅ `SendPasswordReset()` - Line 345
|
|
4. ✅ `SendEmail()` - Line 644
|
|
5. ✅ `SendNewsletter()` - Line 899
|
|
|
|
### Improved Fallback
|
|
Changed from:
|
|
```go
|
|
clubLogo = "https://your-club-logo.png" // Non-existent URL
|
|
```
|
|
|
|
To:
|
|
```go
|
|
clubLogo = "https://via.placeholder.com/400x400.png?text=Logo" // Working placeholder
|
|
```
|
|
|
|
## Benefits
|
|
- ✅ **Better compatibility**: PNG format works in all email clients
|
|
- ✅ **Proper sizing**: Added `width=400` parameter for optimal display
|
|
- ✅ **Reliable fallback**: Using a working placeholder service
|
|
- ✅ **Gmail proxy friendly**: PNG images pass through email proxies without issues
|
|
|
|
## Testing Recommendations
|
|
1. Send a test newsletter to verify logo displays correctly
|
|
2. Test on multiple email clients (Gmail, Outlook, Apple Mail)
|
|
3. Verify the logoapi service responds correctly with PNG format
|
|
4. Check that fallback placeholder works if ClubID is not set
|
|
|
|
## Alternative Solutions (Future Consideration)
|
|
1. **Host logos locally**: Upload logos to your own server/CDN for full control
|
|
2. **Use base64 encoding**: Embed small logos directly in email HTML
|
|
3. **Multiple format fallback**: Include both PNG and JPG variants
|