Эх сурвалжийг харах

Close the file after attachment (#42)

ursc 7 жил өмнө
parent
commit
50fb9532f7
1 өөрчлөгдсөн 2 нэмэгдсэн , 0 устгасан
  1. 2 0
      email.go

+ 2 - 0
email.go

@@ -229,6 +229,8 @@ func (e *Email) AttachFile(filename string) (a *Attachment, err error) {
 	if err != nil {
 		return
 	}
+	defer f.Close()
+
 	ct := mime.TypeByExtension(filepath.Ext(filename))
 	basename := filepath.Base(filename)
 	return e.Attach(f, basename, ct)