For the WriteToSendmail* methods the STDIN pipe should be closed so that a forced EOF is sent to the sending program
This commit is contained in:
Winni Neessen 2022-05-25 10:46:50 +02:00
parent 82cb089a8b
commit 070eb39132
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

5
msg.go
View file

@ -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)
}