From 8cfd7f5c1995adb77477816365b30428d94552dc Mon Sep 17 00:00:00 2001 From: hsht Date: Fri, 28 Jun 2019 20:09:23 +0800 Subject: [PATCH] =?UTF-8?q?email=E7=9A=84Attach=E5=92=8CAttachFile=20?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E6=9C=89=E8=AF=AF=E3=80=82len(args)=20<=201=20&&=20len(args)?= =?UTF-8?q?=20>=202=20=E6=94=B9=E4=B8=BA=20len(args)=20<=201=20||=20len(ar?= =?UTF-8?q?gs)=20>=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/mail.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/mail.go b/utils/mail.go index e3fa1c90..42b1e4d4 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -162,7 +162,7 @@ func (e *Email) Bytes() ([]byte, error) { // AttachFile Add attach file to the send mail func (e *Email) AttachFile(args ...string) (a *Attachment, err error) { - if len(args) < 1 && len(args) > 2 { + if len(args) < 1 || len(args) > 2 { // change && to || err = errors.New("Must specify a file name and number of parameters can not exceed at least two") return } @@ -183,7 +183,7 @@ func (e *Email) AttachFile(args ...string) (a *Attachment, err error) { // Attach is used to attach content from an io.Reader to the email. // Parameters include an io.Reader, the desired filename for the attachment, and the Content-Type. func (e *Email) Attach(r io.Reader, filename string, args ...string) (a *Attachment, err error) { - if len(args) < 1 && len(args) > 2 { + if len(args) < 1 || len(args) > 2 { // change && to || err = errors.New("Must specify the file type and number of parameters can not exceed at least two") return }