mirror of
https://github.com/harness-community/drone-email.git
synced 2026-06-04 18:24:18 +08:00
Merge pull request #7 from drone-plugins/feature/premailer
Added premailer to inline all css rules
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
||||
"github.com/aymerick/douceur/inliner"
|
||||
"github.com/drone/drone-go/drone"
|
||||
"github.com/drone/drone-go/template"
|
||||
"github.com/go-gomail/gomail"
|
||||
@@ -42,7 +43,7 @@ func build(payload *drone.Payload, context *Context) (string, string, string, er
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
html, err := template.RenderTrim(
|
||||
body, err := template.RenderTrim(
|
||||
context.Vargs.Template,
|
||||
payload,
|
||||
)
|
||||
@@ -51,6 +52,12 @@ func build(payload *drone.Payload, context *Context) (string, string, string, er
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
html, err := inliner.Inline(body)
|
||||
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
plain, err := html2text.FromString(
|
||||
html,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user