فهرست منبع

Close the file after attachment (#42)

ursc 8 سال پیش
والد
کامیت
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)