fix(GODT-3041): Fix Invalid Or Missing message signature during send

If we update the address after determining the sender address is
different, we also need to refresh the identity state in order to use
the right encryption keys.
This commit is contained in:
Leander Beernaert 2023-11-03 10:35:36 +01:00
parent 1c385d5c9b
commit b8a33b9618
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ func (s *Service) smtpSendMail(ctx context.Context, authID string, from string,
// If the message contains a sender, use it instead of the one from the return path.
if sender, ok := getMessageSender(parser); ok {
from = sender
fromAddr, err = s.identityState.GetAddr(from)
if err != nil {
logrus.WithError(err).Errorf("Failed to get identity from sender address %v", sender)
return ErrInvalidReturnPath
}
}
// Load the user's mail settings.