Skip to content

Commit db9358f

Browse files
author
Winni Neessen
authored
Merge pull request #6 from wneessen/fix_sendmailpipe
Address #5
2 parents 82cb089 + fa7066c commit db9358f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

msg.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type Msg struct {
5858
}
5959

6060
// SendmailPath is the default system path to the sendmail binary
61-
const SendmailPath = "/usr/bin/sendmail"
61+
const SendmailPath = "/usr/sbin/sendmail"
6262

6363
// MsgOption returns a function that can be used for grouping Msg options
6464
type MsgOption func(*Msg)
@@ -547,7 +547,10 @@ func (m *Msg) WriteToSendmailWithContext(ctx context.Context, sp string, a ...st
547547
return fmt.Errorf("sendmail command failed: %s", serr)
548548
}
549549

550-
// Wait for completion or cancellation of the sendmail executable
550+
// Close STDIN and wait for completion or cancellation of the sendmail executable
551+
if err := si.Close(); err != nil {
552+
return fmt.Errorf("failed to close STDIN pipe: %w", err)
553+
}
551554
if err := ec.Wait(); err != nil {
552555
return fmt.Errorf("sendmail command execution failed: %w", err)
553556
}

0 commit comments

Comments
 (0)