Skip to content
This repository was archived by the owner on Aug 9, 2026. It is now read-only.

Commit 313bd8b

Browse files
authored
feat(email): replace unicode checkmark with inline PNG image (#172)
The signer-verified circle previously rendered a unicode `✓` glyph which is styled inconsistently across mail clients. Embed a PNG of the PostGuard checkmark via `cid:pg-check` to match the shape used in the download page UI.
1 parent 63066a1 commit 313bd8b

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/email.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ fn take_firstname_lastname_pair(attrs: &mut Vec<(String, String)>) -> Option<Str
109109
/// HTML-only-plus-remote-image spam signal flagged in postguard#197.
110110
const LOGO_PNG: &[u8] = include_bytes!("../templates/email/pg_logo.png");
111111

112+
/// Inline checkmark glyph used inside the signer-verified circle in the
113+
/// HTML email, referenced via `cid:pg-check`. Replaces the previous
114+
/// unicode `&#10003;` so the mark renders consistently across clients.
115+
const CHECK_PNG: &[u8] = include_bytes!("../templates/email/check.png");
116+
112117
use serde::{Deserialize, Serialize};
113118
use url::Url;
114119

@@ -207,10 +212,13 @@ struct EmailTextTemplate<'a> {
207212
fn build_body(html: String, text: String) -> Result<MultiPart, Box<dyn std::error::Error>> {
208213
let logo = Attachment::new_inline("pg-logo".to_string())
209214
.body(LOGO_PNG.to_vec(), "image/png".parse::<ContentType>()?);
215+
let check = Attachment::new_inline("pg-check".to_string())
216+
.body(CHECK_PNG.to_vec(), "image/png".parse::<ContentType>()?);
210217

211218
let related = MultiPart::related()
212219
.singlepart(SinglePart::html(html))
213-
.singlepart(logo);
220+
.singlepart(logo)
221+
.singlepart(check);
214222

215223
Ok(MultiPart::alternative()
216224
.singlepart(SinglePart::plain(text))

templates/email/check.png

3.1 KB
Loading

templates/email/email.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
{% if sender_email != "" %}
4343
<div style="margin-top:40px;padding-top:30px;border-top:1px solid #C6E2F6;text-align:center;">
4444
<div style="margin-bottom:12px;">
45-
<span style="display:inline-block;width:32px;height:32px;line-height:32px;border-radius:50%;border:2px solid #5F7381;text-align:center;font-size:16px;color:#5F7381;box-sizing:border-box;">&#10003;</span>
45+
<span style="display:inline-block;width:32px;height:32px;line-height:32px;border-radius:50%;border:2px solid #5F7381;text-align:center;box-sizing:border-box;">
46+
<img src="cid:pg-check" alt="" width="16" height="13" style="display:inline-block;vertical-align:middle;" />
47+
</span>
4648
</div>
4749
<p style="font-size:13px;color:#5F7381;margin:0 0 6px 0;">{{files_from}}</p>
4850
<p style="font-size:15px;font-weight:700;color:#030E17;margin:0 0 12px 0;">{{sender_email}}</p>

0 commit comments

Comments
 (0)