diff --git a/README.md b/README.md index 0033456..2a36c29 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ func main() { ## Maintainers -[@MrZ1836](https://github.com/mrz1836) +[@MrZ](https://github.com/mrz1836) ## Contributing diff --git a/aws_ses.go b/aws_ses.go index 040a9d5..7340aae 100644 --- a/aws_ses.go +++ b/aws_ses.go @@ -76,8 +76,7 @@ func (m *MailService) sendWithAwsSes(email *Email) (err error) { // Create the email buffer and pass to the ses service var buf *bytes.Buffer - buf, err = mail.MimeBuf() - if err != nil { + if buf, err = mail.MimeBuf(); err != nil { return err } diff --git a/email.go b/email.go index 47a6591..c7f1022 100644 --- a/email.go +++ b/email.go @@ -64,8 +64,7 @@ func (e *Email) ApplyTemplates(htmlTemplate *template.Template, textTemplate *te if htmlTemplate != nil { // Read the struct into the HTML buffer - err = htmlTemplate.ExecuteTemplate(&buffer, htmlTemplate.Name(), emailData) - if err != nil { + if err = htmlTemplate.ExecuteTemplate(&buffer, htmlTemplate.Name(), emailData); err != nil { return } @@ -80,8 +79,7 @@ func (e *Email) ApplyTemplates(htmlTemplate *template.Template, textTemplate *te if textTemplate != nil { // Read the struct into the text buffer - err = textTemplate.ExecuteTemplate(&buffer, textTemplate.Name(), emailData) - if err != nil { + if err = textTemplate.ExecuteTemplate(&buffer, textTemplate.Name(), emailData); err != nil { return } @@ -105,9 +103,7 @@ func (e *Email) ParseHTMLTemplate(htmlLocation string) (htmlTemplate *template.T // Read HTML template file var tempBytes []byte - tempBytes, err = ioutil.ReadFile(htmlLocation) - if err != nil { - err = fmt.Errorf("") + if tempBytes, err = ioutil.ReadFile(htmlLocation); err != nil { return } @@ -117,14 +113,12 @@ func (e *Email) ParseHTMLTemplate(htmlLocation string) (htmlTemplate *template.T // Inject styles tempBytes = bytes.Replace(tempBytes, []byte("{{.Styles}}"), e.CSS, -1) var tempString string - tempString, err = inliner.Inline(string(tempBytes)) - if err != nil { + if tempString, err = inliner.Inline(string(tempBytes)); err != nil { return } // Replace the string with template - htmlTemplate, err = e.ParseTemplate(htmlLocation) - if err != nil { + if htmlTemplate, err = e.ParseTemplate(htmlLocation); err != nil { return } _, err = htmlTemplate.Parse(tempString) diff --git a/go.mod b/go.mod index bba0714..91c3341 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,12 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.5.0 // indirect + github.com/andybalholm/cascadia v1.1.0 // indirect github.com/aymerick/douceur v0.2.0 github.com/domodwyer/mailyak v3.1.1+incompatible github.com/gorilla/css v1.0.0 // indirect github.com/mattbaird/gochimp v0.0.0-20180111040707-a267553896d1 - github.com/mrz1836/postmark v1.2.2 + github.com/mrz1836/postmark v1.2.3 github.com/sourcegraph/go-ses v0.0.0-20160405160939-6bd8d17cf7c1 - golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 // indirect + golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect ) diff --git a/go.sum b/go.sum index 09307b4..9d477cc 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg= github.com/andybalholm/cascadia v1.0.0 h1:hOCXnnZ5A+3eVDX8pvgl4kofXv2ELss0bKcqRySc45o= github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= +github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/domodwyer/mailyak v3.1.1+incompatible h1:oPtXn3+56LEFbdqH0bpuPRsqtijW9l2POpQe9sTUsSI= @@ -10,14 +12,16 @@ github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/mattbaird/gochimp v0.0.0-20180111040707-a267553896d1 h1:dkQj0GZch2rk/ODbwy17kP5tbmPcMGiw1KYOi6Ni0/w= github.com/mattbaird/gochimp v0.0.0-20180111040707-a267553896d1/go.mod h1:UaYd2gciRA1AoYEN6S+EiSNFK/0XHj9e1Wgloicgh6s= -github.com/mrz1836/postmark v1.2.2 h1:SP0FihxskYraC1h+4Oxv1f4d3Csj3nMQ9PLyr1kQqdc= -github.com/mrz1836/postmark v1.2.2/go.mod h1:mpI6b64GBYN7sNz0BQEaRtHK+D5546YDNQp9FtCEHaM= +github.com/mrz1836/postmark v1.2.3 h1:yvi8UesSpUhHc3fB30Yhe+fr78/0j0rbBATOVgz3GnM= +github.com/mrz1836/postmark v1.2.3/go.mod h1:JCDGKzJvuZGVcyhNxyRfAKp9gIDnGrCd+7nOXMaLiR0= github.com/sourcegraph/go-ses v0.0.0-20160405160939-6bd8d17cf7c1 h1:2Ndulo7XO8FH6BqX62+FG9Hvl1uOBwDSrE6BAkTNHtA= github.com/sourcegraph/go-ses v0.0.0-20160405160939-6bd8d17cf7c1/go.mod h1:7pQ21TK+WkdBIwDfMovYhmNyGeBduRj3S089GgpNQ3g= +goji.io v2.0.2+incompatible h1:uIssv/elbKRLznFUy3Xj4+2Mz/qKhek/9aZQDUMae7c= +goji.io v2.0.2+incompatible/go.mod h1:sbqFwrtqZACxLBTQcdgVjFh54yGVCvwq8+w49MVMMIk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 h1:e6HwijUxhDe+hPNjZQQn9bA5PW3vNmnN64U2ZW759Lk= -golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/mandrill.go b/mandrill.go index 46c52f5..248106a 100644 --- a/mandrill.go +++ b/mandrill.go @@ -82,8 +82,7 @@ func (m *MailService) sendWithMandrill(email *Email) (err error) { // Read all content from the attachment reader := bufio.NewReader(attachment.FileReader) var content []byte - content, err = ioutil.ReadAll(reader) - if err != nil { + if content, err = ioutil.ReadAll(reader); err != nil { return } @@ -98,8 +97,7 @@ func (m *MailService) sendWithMandrill(email *Email) (err error) { // Execute the send var sendResponse []gochimp.SendResponse - sendResponse, err = m.mandrillService.MessageSend(message, false) - if err != nil { + if sendResponse, err = m.mandrillService.MessageSend(message, false); err != nil { return } diff --git a/postmark.go b/postmark.go index 96463d7..3733f20 100644 --- a/postmark.go +++ b/postmark.go @@ -68,8 +68,7 @@ func (m *MailService) sendWithPostmark(email *Email) (err error) { // Read all content from the attachment reader := bufio.NewReader(attachment.FileReader) var content []byte - content, err = ioutil.ReadAll(reader) - if err != nil { + if content, err = ioutil.ReadAll(reader); err != nil { return } @@ -94,8 +93,7 @@ func (m *MailService) sendWithPostmark(email *Email) (err error) { // Send the email var resp postmark.EmailResponse - resp, err = m.postmarkService.SendEmail(postmarkEmail) - if err != nil { + if resp, err = m.postmarkService.SendEmail(postmarkEmail); err != nil { return }