The current code reads the full body in of every part resulting in high memory usage if the email contains big attachments or many instances are running at the same time.
It would be better to build a custom io.Writer buffer or simply return the io.Reader allowing the app to decided to io.Copy, bytes.Buffer, or ReadAll as needed.
The current code reads the full body in of every part resulting in high memory usage if the email contains big attachments or many instances are running at the same time.
It would be better to build a custom io.Writer buffer or simply return the io.Reader allowing the app to decided to
io.Copy
,bytes.Buffer
, orReadAll
as needed.