all repos — navani @ 99c9e4751e5fe965bc1de27c9ad99f66f06e2330

forlater's primary mail processing service

Send mail only if text/html
Anirudh Oppiliappan x@icyphox.sh
Fri, 01 Oct 2021 15:52:48 +0530
commit

99c9e4751e5fe965bc1de27c9ad99f66f06e2330

parent

3d75c4dca23f65ff2a15678e06f6979c012c71b3

1 files changed, 10 insertions(+), 10 deletions(-)

jump to
M main.gomain.go

@@ -37,18 +37,18 @@ if err != nil {

log.Printf("reader fetch: %v\n", err) } - if resp.MIMEType != "text/html" { - err = mail.SendAttachment(resp, m.From, u) - if err != nil { - log.Printf("error sending attachment to: %s: %v\n", m.From, err) - } else { - log.Printf("sent attachment to %s: %s\n", m.From, resp.MIMEType) - } - break - } + // if resp.MIMEType != "text/html" { + // err = mail.SendAttachment(resp, m.From, u) + // if err != nil { + // log.Printf("error sending attachment to: %s: %v\n", m.From, err) + // } else { + // log.Printf("sent attachment to %s: %s\n", m.From, resp.MIMEType) + // } + // break + // } article, err := reader.Readable(resp.Body, parsedURL) - if err == nil { + if (err == nil) && (resp.MIMEType == "text/html") { err = mail.SendArticle(&article, m.From, true) if err != nil { log.Printf("error sending mail to: %s: %v\n", m.From, err)