Move it inside a try block so it doesn’t error out

This commit is contained in:
Jeff Leung 2023-01-24 15:55:50 -08:00
parent 587c21fa03
commit 4700b09caf
1 changed files with 12 additions and 12 deletions

View File

@ -40,6 +40,9 @@ namespace TwilioSMSReceiver.Common.MessageHandlers
public async Task<bool> RelaySms(SMSModel model)
{
try
{
var graphClient = BuildGraphClient();
var message = new Message
{
Subject = $"Received SMS from {model.SenderNumber} to {model.SenderNumber}",
@ -54,15 +57,12 @@ namespace TwilioSMSReceiver.Common.MessageHandlers
{
EmailAddress = new EmailAddress
{
Address = "frannis@contoso.onmicrosoft.com"
Address = _configuration.GetSection("GraphSmtp")["destEmail"]
}
}
}
};
try
{
var graphClient = BuildGraphClient();
await graphClient.Me.SendMail(message).Request().PostAsync();
return true;