Closed kron4eg closed 9 years ago
Until very recently Gomail used smtp.SendMail
from the standard library to send emails and that function takes msg []byte
as an argument. So the whole email needed to be in memory anyway.
Now that Gomail use a custom function to send emails, the email could be streamed to the SMTP server. So it is true that the content
field of File
could now be an io.Reader
instead of []byte
.
However doing that change will break backward compatibility because the signatures of File
, OpenFile
, CreateFile
and SetSendMail
will have to be updated.
Since this is not a big issue (email attachments are supposed to be relatively small) I will wait for other breaking changes before fixing this issue and bumping the version number.
I have the feeling that those signatures should have io.Reader instead of *File
And using
ioutil.ReadFile
(insideCreateFile()
) will dump whole file contents right into memory...Which is not very good for performance and in general.