| 729 | var emailLabelPattern = regexp.MustCompile("[+][^@]+@") |
| 730 | |
| 731 | func (a *API) checkEmailAddressAuthorization(email string) bool { |
| 732 | if len(a.config.External.Email.AuthorizedAddresses) > 0 { |
| 733 | // allow labelled emails when authorization rules are in place |
| 734 | normalized := emailLabelPattern.ReplaceAllString(email, "@") |
| 735 | |
| 736 | for _, authorizedAddress := range a.config.External.Email.AuthorizedAddresses { |
| 737 | if strings.EqualFold(normalized, authorizedAddress) { |
| 738 | return true |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | return false |
| 743 | } |
| 744 | |
| 745 | return true |
| 746 | } |
| 747 | |
| 748 | type sendEmailParams struct { |
| 749 | emailActionType string |