Skip to content

Commit

Permalink
Address #5
Browse files Browse the repository at this point in the history
For the WriteToSendmail* methods the STDIN pipe should be closed so that a forced EOF is sent to the sending program
  • Loading branch information
wneessen committed May 25, 2022
1 parent 82cb089 commit 070eb39
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,10 @@ func (m *Msg) WriteToSendmailWithContext(ctx context.Context, sp string, a ...st
return fmt.Errorf("sendmail command failed: %s", serr)
}

// Wait for completion or cancellation of the sendmail executable
// Close STDIN and wait for completion or cancellation of the sendmail executable
if err := si.Close(); err != nil {
return fmt.Errorf("failed to close STDIN pipe: %w", err)
}
if err := ec.Wait(); err != nil {
return fmt.Errorf("sendmail command execution failed: %w", err)
}
Expand Down

0 comments on commit 070eb39

Please sign in to comment.