Skip to content

Commit

Permalink
PHP mail() function triggers 'missing recipient' message
Browse files Browse the repository at this point in the history
#3

The re for find To: doesn't work correctly
Here is a fix.
  • Loading branch information
iefbr14 committed Nov 20, 2015
1 parent 98ecd08 commit 59a115c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ func Go() {
if len(recip) == 0 {
// We only need to parse the message to get a recipient if none where
// provided on the command line.
re := regexp.MustCompile("(?im)^To: (.*)\r\n$")
// re := regexp.MustCompile("(?im)^To: (.*)\r*\n$")
re := regexp.MustCompile("(?im)^To: (.*)\r*$")
n := bytes.IndexByte(body, 0)
var bodyStr string;
if n < 0 {
bodyStr = string(body)
} else {
bodyStr = string(body[:n])
}
bodyStr := string(body[:n])
includedRecip := re.FindAllString(bodyStr, -1)
if includedRecip == nil {
fmt.Fprintln(os.Stderr, "missing recipient")
Expand Down

0 comments on commit 59a115c

Please sign in to comment.