Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body of message is not written in second call to Write #8

Closed
inliquid opened this issue May 26, 2022 · 1 comment
Closed

Body of message is not written in second call to Write #8

inliquid opened this issue May 26, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@inliquid
Copy link
Contributor

Just found an interesting issue. In my scenario I first call Msg.Write to log message contents to debug logger and after that Msg.WriteToSendmailWithContext does not populate body of the message. Removing first call to Msg.Write or making two sequential calls to Msg.Write proves that. It seems that underlying writer shifts its current position to the end of buffer preventing body from being read second time. In original gomail this works normally. Didn't have much time to look into it.

@wneessen wneessen added the bug Something isn't working label May 27, 2022
@wneessen wneessen self-assigned this May 27, 2022
wneessen added a commit that referenced this issue May 27, 2022
@wneessen
Copy link
Owner

Thanks for the report. You are right... we were using io.Copy to write to the body string/alternative string to the io.Writer. This placed the byte position of the buffer to be at the EOF after the first WriteTo() call leaving the output of a 2nd call to WriteTo() empty.

This has now been fixed with c001ac5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants