diff --git a/backend/core/src/Core.Infrastructure/Compliance/SendGridMailService/SendGridMailService.cs b/backend/core/src/Core.Infrastructure/Compliance/SendGridMailService/SendGridMailService.cs index 0dc832a..8a17f34 100644 --- a/backend/core/src/Core.Infrastructure/Compliance/SendGridMailService/SendGridMailService.cs +++ b/backend/core/src/Core.Infrastructure/Compliance/SendGridMailService/SendGridMailService.cs @@ -35,7 +35,7 @@ public async Task SendMailAsync(Mail mail, Customer customer, Transaction transa } var from = new EmailAddress(_mailOptions.Sender); - var to = new EmailAddress(mail.Recipient?.Email) ?? throw new CustomErrorsException("MailService", "toAddress", "An error occured while sending mail."); + var to = new EmailAddress(mail.Recipient?.Email?.ToLower().Trim()) ?? throw new CustomErrorsException("MailService", "toAddress", "An error occured while sending mail."); var msg = new SendGridMessage(); @@ -83,7 +83,7 @@ public async Task SendMailAsync(Mail mail, Customer customer, Transaction transa public async Task SendOTPCodeMailAsync(Customer customer, string otpCode) { var from = new EmailAddress(_mailOptions.Sender); - var to = new EmailAddress(customer.Email); + var to = new EmailAddress(customer.Email?.ToLower().Trim()); var msg = new SendGridMessage(); msg.SetFrom(new EmailAddress(from.Email, from.Name)); diff --git a/backend/core/src/Core.Infrastructure/Nexus/Repositories/NexusCustomerRepository.cs b/backend/core/src/Core.Infrastructure/Nexus/Repositories/NexusCustomerRepository.cs index 4c37f43..a334ee0 100644 --- a/backend/core/src/Core.Infrastructure/Nexus/Repositories/NexusCustomerRepository.cs +++ b/backend/core/src/Core.Infrastructure/Nexus/Repositories/NexusCustomerRepository.cs @@ -33,7 +33,7 @@ public async Task CreateAsync(Customer customer, string? ip = null, Cancellation var query = new Dictionary { - { "Email", customer.Email.TrimEnd() } + { "Email", customer.Email.ToLower().Trim() } }; var existingCustomersWithEmail = await _tokenServer.Customers.Get(query); @@ -60,7 +60,7 @@ public async Task CreateAsync(Customer customer, string? ip = null, Cancellation BankAccountNumber = null } ]) - .SetEmail(customer.Email) + .SetEmail(customer.Email.ToLower().Trim()) .SetStatus(status) .SetCustomData(customer.Data); @@ -84,7 +84,7 @@ public async Task UpdateAsync(Customer customer, CancellationToken cancellationT } var builder = new UpdateCustomerRequestBuilder(customer.CustomerCode) - .SetEmail(customer.Email) + .SetEmail(customer.Email.ToLower().Trim()) .SetStatus(status) .SetCustomData(customer.Data);