mirror of
https://github.com/axllent/mailpit.git
synced 2025-08-15 20:13:16 +02:00
Fix: Exclude "sendmail" from recipients list when using mailpit sendmail <options>
This commit is contained in:
@@ -16,7 +16,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/mail"
|
"net/mail"
|
||||||
"net/smtp"
|
"net/smtp"
|
||||||
"os"
|
"os"
|
||||||
@@ -93,6 +93,11 @@ func Run() {
|
|||||||
// allow recipients to be passed as an argument
|
// allow recipients to be passed as an argument
|
||||||
recipients = flag.Args()
|
recipients = flag.Args()
|
||||||
|
|
||||||
|
// if run via `mailpit sendmail ...` then remove `sendmail` from "recipients"
|
||||||
|
if len(recipients) > 0 && recipients[0] == "sendmail" {
|
||||||
|
recipients = recipients[1:]
|
||||||
|
}
|
||||||
|
|
||||||
if showHelp {
|
if showHelp {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
@@ -117,7 +122,7 @@ func Run() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(os.Stdin)
|
body, err := io.ReadAll(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error reading stdin")
|
fmt.Fprintln(os.Stderr, "error reading stdin")
|
||||||
os.Exit(11)
|
os.Exit(11)
|
||||||
|
Reference in New Issue
Block a user