Skip to content

Commit

Permalink
fix: add more basic email patterns
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Jan 18, 2025
1 parent 38dec45 commit 54231a3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions services/mailer/email_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"slices"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -113,14 +112,10 @@ func (s *Server) generateEmailProposals(ctx context.Context, userInfo *userinfo.
}
}

sort.Slice(emails, func(i, j int) bool {
return emails[i] < emails[j]
})
slices.Sort(emails)
utils.RemoveSliceDuplicates(emails)

sort.Slice(domains, func(i, j int) bool {
return domains[i] < domains[j]
})
slices.Sort(domains)
utils.RemoveSliceDuplicates(domains)

return emails, domains, nil
Expand All @@ -129,6 +124,8 @@ func (s *Server) generateEmailProposals(ctx context.Context, userInfo *userinfo.
func getBasicNameEmails(firstname string, lastname string) []string {
return []string{ // User fullname: Erika Mustermann
utils.Slug(fmt.Sprintf("%s.%s", firstname, lastname)), // erika.mustermann
utils.Slug(fmt.Sprintf("%s", firstname)), // erika
utils.Slug(fmt.Sprintf("%s", lastname)), // mustermann
utils.Slug(fmt.Sprintf("%s%s", utils.StringFirstN(firstname, 1), lastname)), // emustermann
utils.Slug(fmt.Sprintf("%s%s", firstname, utils.StringFirstN(lastname, 1))), // erikam
utils.Slug(fmt.Sprintf("%s.%s", utils.StringFirstN(firstname, 1), utils.StringFirstN(lastname, 3))), // eri.mus
Expand Down

0 comments on commit 54231a3

Please sign in to comment.