Commit 7ae4cab
committed
fix(notify-*-mail): render Icinga logo inline on hosts with long FQDNs
On hosts with a long FQDN (>80 characters, typically with
multiple hyphens), the Icinga logo in notification mails used to
show up as a base64-encoded attachment instead of the embedded
banner image inside the HTML body.
Root cause: `email.utils.make_msgid()` defaults to
`socket.getfqdn()` for the Content-ID domain. Long FQDNs push
the resulting header past 80 characters, at which point Python's
quoted-printable encoder wraps it across multiple lines and
breaks the `cid:<...>` reference that the HTML body uses to pull
the inline logo image. See python/cpython#100293 for the
upstream limitation.
Fix: pin the domain to `socket.gethostname()` (the short
hostname), which keeps the Content-ID well under the 80-char
limit. The short hostname is already imported in both notify
plugins for the HTML template's `icinga_host=gethostname()`
substitution, so no new imports are needed.
Closes #7901 parent c32e20b commit 7ae4cab
3 files changed
Lines changed: 17 additions & 4 deletions
File tree
- notification-plugins
- notify-host-mail
- notify-service-mail
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
462 | 468 | | |
463 | 469 | | |
464 | 470 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
482 | 488 | | |
483 | 489 | | |
484 | 490 | | |
| |||
0 commit comments