Validate recipient emails in send before asking for their public keys

This commit is contained in:
Pavel Škoda
2020-05-19 18:33:32 +02:00
committed by Jakub Cuth
parent c6c6cfc7d7
commit 4e2ab9b389
3 changed files with 23 additions and 0 deletions

View File

@ -209,6 +209,10 @@ func (su *smtpUser) Send(from string, to []string, messageReader io.Reader) (err
containsUnencryptedRecipients := false
for _, email := range to {
if !looksLikeEmail(email) {
return errors.New(`"` + email + `" is not a valid recipient.`)
}
// PMEL 1.
contactEmails, err := su.client.GetContactEmailByEmail(email, 0, 1000)
if err != nil {