Files
MyClub/DOCS/EMAIL_LOGO_FIX.md
T
Tomáš Dvořák 12cba639b9 upload
2025-10-16 13:32:05 +02:00

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

  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:

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

  1. SendAdminWelcome() - Line 86
  2. SendPasswordResetCode() - Line 237
  3. SendPasswordReset() - Line 345
  4. SendEmail() - Line 644
  5. 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=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