the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
966 stars 115 forks source link

Avatars plugin: Priority of avatar image sources #1395

Closed yasuhirokimura closed 7 months ago

yasuhirokimura commented 7 months ago

Currently Avatars plugin provides 3 sources to get the avatar image of message. That is, preload valid domain icons, BIMI and Gravatar.

By the way, it is possbile that multiple sources are available with single message (= single mail address). Then which one is used under such situation?

the-djmaze commented 7 months ago

In order:

  1. cached (if exists)
  2. BIMI
  3. Gravatar
  4. service icon
  5. identicon svg

https://github.com/the-djmaze/snappymail/blob/5747b7add6de262569092294b43441da2a2ff4bb/plugins/avatars/index.php#L196-L291

yasuhirokimura commented 7 months ago

In order:

  1. cached (if exists)
  2. BIMI
  3. Gravatar
  4. service icon
  5. identicon svg

I got conflicting result with messages from amazon.com.

The domain has BIMI DNS record as following.

yasu@eastasia[1455]% dig default._bimi.amazon.com txt                                                                      ~

; <<>> DiG 9.18.20 <<>> default._bimi.amazon.com txt
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22900
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 0d600b709273ce230100000065ae466dc9ab7fd998e63486 (good)
;; QUESTION SECTION:
;default._bimi.amazon.com.      IN      TXT

;; ANSWER SECTION:
default._bimi.amazon.com. 900   IN      TXT     "v=BIMI1;l=https://d3frv9g52qce38.cloudfront.net/amazondefault/order_329474121_logo.svg;a=https://d3frv9g52qce38.cloudfront.net/amazondefault/amazon_web_services_inc.pem"

;; Query time: 8 msec
;; SERVER: ::1#53(::1) (UDP)
;; WHEN: Mon Jan 22 19:41:49 JST 2024
;; MSG SIZE  rcvd: 262

According to it following SVG image is specified as BIMI indicator.

https://d3frv9g52qce38.cloudfront.net/amazondefault/order_329474121_logo.svg

And it is different from amazon.com.png included in Avatars plugin.

I did following steps,

  1. Configure Avatars plugin as following.
    • Identicon: Name characters else silhouette
    • Preload valid domain icons: On
    • Delay lookup: On
    • BIMI: On
    • Gravatar: On
  2. Remove all files under _data_/_default_/avatars.
  3. Restart web server and/or PHP fpm process.
  4. Open message whose domain part of From: address is amazon.com.

If the plugin works as is described, BIMI indicator should be used as avatar. But actually I got following result.

SnappyMail avators amazon com

As you can see amazon.com.png included in Avatars plugin is displayed.