Open gnsx opened 6 years ago
Your anonymous function in SetCopyFunc
does not bind i
, so by the time the function is called (during message assembly; so way later) all their i
have 2 in them.
Instead use a closure, which binds the required i
. Like so https://play.golang.org/p/CZgr8aq9KE
I'm trying to send attachments by directly reading from the file buffer instead of physical files on the disk.
Attachment Struct
After attaching 3 files, tried doing the following
The files get sent successfully but, all the files become of the same filesize of the last file that was attached. Eg: File A 1kB, File B 2kB, FIle C 3kB. ALl the files become 3kB.
However if the files are manually attached like shown below, they get sent just fine with the correct content being reproduced on the email