Skip to content

Commit

Permalink
Merge pull request #6 from wneessen/fix_sendmailpipe
Browse files Browse the repository at this point in the history
Address #5
  • Loading branch information
wneessen authored May 25, 2022
2 parents 82cb089 + fa7066c commit db9358f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type Msg struct {
}

// SendmailPath is the default system path to the sendmail binary
const SendmailPath = "/usr/bin/sendmail"
const SendmailPath = "/usr/sbin/sendmail"

// MsgOption returns a function that can be used for grouping Msg options
type MsgOption func(*Msg)
Expand Down 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 db9358f

Please sign in to comment.