smtp: case-insensitive email address comparison, fixes #20

This commit is contained in:
emersion 2018-01-09 17:17:59 +01:00
parent 2c300de8cd
commit ed67f2a3f5
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"strings"
"github.com/emersion/go-message/mail"
"github.com/emersion/go-smtp"
@ -65,7 +66,7 @@ func (u *user) Send(from string, to []string, r io.Reader) error {
fromAddrStr := fromList[0].Address
var fromAddr *protonmail.Address
for _, addr := range u.u.Addresses {
if addr.Email == fromAddrStr {
if strings.EqualFold(addr.Email, fromAddrStr) {
fromAddr = addr
break
}