Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of minor bug fixes. #6

Merged
merged 3 commits into from
Dec 6, 2015
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