mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-25 19:54:06 +03:00
Specify mimetype for email attachments
This fixes that some email client might not allow previewing the qrcode image.
This commit is contained in:
parent
2fdafd34ca
commit
9cb4c26ac5
4 changed files with 5 additions and 4 deletions
|
@ -3,6 +3,7 @@ package emailer
|
|||
type Attachment struct {
|
||||
Name string
|
||||
Data []byte
|
||||
MimeType string
|
||||
}
|
||||
|
||||
type Emailer interface {
|
||||
|
|
|
@ -39,7 +39,7 @@ func (o *SendgridApiMail) Send(toName string, to string, subject string, content
|
|||
var att mail.Attachment
|
||||
encoded := base64.StdEncoding.EncodeToString(attachments[i].Data)
|
||||
att.SetContent(encoded)
|
||||
att.SetType("text/plain")
|
||||
att.SetType(attachments[i].MimeType)
|
||||
att.SetFilename(attachments[i].Name)
|
||||
att.SetDisposition("attachment")
|
||||
toAdd = append(toAdd, &att)
|
||||
|
|
|
@ -91,7 +91,7 @@ func (o *SmtpMail) Send(toName string, to string, subject string, content string
|
|||
SetBody(mail.TextHTML, content)
|
||||
|
||||
for _, v := range attachments {
|
||||
email.Attach(&mail.File{Name: v.Name, Data: v.Data})
|
||||
email.Attach(&mail.File{Name: v.Name, Data: v.Data, MimeType: v.MimeType})
|
||||
}
|
||||
|
||||
err = email.Send(smtpClient)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue