这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ Or override the destination SMTP server:
./mhsendmail -smtp-addr "localhost:1026" test@mailhog.local ...
```

To use from php.ini

```
sendmail_path = /usr/local/bin/mhsendmail
```

### Licence

Copyright ©‎ 2015, Ian Kent (http://iankent.uk)

Released under MIT license, see [LICENSE](LICENSE.md) for details.


10 changes: 8 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +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)
bodyStr := string(body[:n])
var bodyStr string;
if n < 0 {
bodyStr = string(body)
} else {
bodyStr = string(body[:n])
}
includedRecip := re.FindAllString(bodyStr, -1)
if includedRecip == nil {
fmt.Fprintln(os.Stderr, "missing recipient")
Expand Down