Skip to content

Commit 619abc6

Browse files
committed
feat: set default image width to 100% in email templates
1 parent 5d4338f commit 619abc6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/email/template.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ func (tm *TemplateManager) RenderTemplate(name string, data interface{}) (string
8383
ContentType: fmt.Sprintf("image/%s", filepath.Ext(imageSrc)[1:]),
8484
Header: header,
8585
})
86-
return template.HTML(fmt.Sprintf("<img src=\"cid:%s\" alt=\"%s\">", imageSrc, imageSrc))
86+
// when without width, email client will use the original size... so we need to set width to 100%
87+
return template.HTML(fmt.Sprintf("<img src=\"cid:%s\" alt=\"%s\" width=\"100%%\">", imageSrc, imageSrc))
8788
},
8889
"imageWithSize": func(imageSrc, width, height string) template.HTML {
8990
imagePath := filepath.Join(tm.imageDir, imageSrc)

0 commit comments

Comments
 (0)