Move it inside a try block so it doesn’t error out
This commit is contained in:
parent
587c21fa03
commit
4700b09caf
|
|
@ -40,29 +40,29 @@ namespace TwilioSMSReceiver.Common.MessageHandlers
|
|||
|
||||
public async Task<bool> RelaySms(SMSModel model)
|
||||
{
|
||||
var message = new Message
|
||||
try
|
||||
{
|
||||
Subject = $"Received SMS from {model.SenderNumber} to {model.SenderNumber}",
|
||||
Body = new ItemBody
|
||||
var graphClient = BuildGraphClient();
|
||||
var message = new Message
|
||||
{
|
||||
ContentType = BodyType.Text,
|
||||
Content = model.MessageContents
|
||||
},
|
||||
ToRecipients = new List<Recipient>()
|
||||
Subject = $"Received SMS from {model.SenderNumber} to {model.SenderNumber}",
|
||||
Body = new ItemBody
|
||||
{
|
||||
ContentType = BodyType.Text,
|
||||
Content = model.MessageContents
|
||||
},
|
||||
ToRecipients = new List<Recipient>()
|
||||
{
|
||||
new Recipient
|
||||
{
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue