mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
2.2 KiB
2.2 KiB
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
- SVG format incompatibility: SVG images are not well-supported in email clients
- Email client proxying: Gmail and other email clients proxy external images, which can fail for certain formats
- 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:
clubLogo = fmt.Sprintf("https://logoapi.sportcreative.eu/logos/%s?format=svg", clubID)
After:
// 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
- ✅
SendAdminWelcome()- Line 86 - ✅
SendPasswordResetCode()- Line 237 - ✅
SendPasswordReset()- Line 345 - ✅
SendEmail()- Line 644 - ✅
SendNewsletter()- Line 899
Improved Fallback
Changed from:
clubLogo = "https://your-club-logo.png" // Non-existent URL
To:
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=400parameter for optimal display - ✅ Reliable fallback: Using a working placeholder service
- ✅ Gmail proxy friendly: PNG images pass through email proxies without issues
Testing Recommendations
- Send a test newsletter to verify logo displays correctly
- Test on multiple email clients (Gmail, Outlook, Apple Mail)
- Verify the logoapi service responds correctly with PNG format
- Check that fallback placeholder works if ClubID is not set
Alternative Solutions (Future Consideration)
- Host logos locally: Upload logos to your own server/CDN for full control
- Use base64 encoding: Embed small logos directly in email HTML
- Multiple format fallback: Include both PNG and JPG variants