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)
|
public async Task<bool> RelaySms(SMSModel model)
|
||||||
{
|
{
|
||||||
var message = new Message
|
try
|
||||||
{
|
{
|
||||||
Subject = $"Received SMS from {model.SenderNumber} to {model.SenderNumber}",
|
var graphClient = BuildGraphClient();
|
||||||
Body = new ItemBody
|
var message = new Message
|
||||||
{
|
{
|
||||||
ContentType = BodyType.Text,
|
Subject = $"Received SMS from {model.SenderNumber} to {model.SenderNumber}",
|
||||||
Content = model.MessageContents
|
Body = new ItemBody
|
||||||
},
|
{
|
||||||
ToRecipients = new List<Recipient>()
|
ContentType = BodyType.Text,
|
||||||
|
Content = model.MessageContents
|
||||||
|
},
|
||||||
|
ToRecipients = new List<Recipient>()
|
||||||
{
|
{
|
||||||
new Recipient
|
new Recipient
|
||||||
{
|
{
|
||||||
EmailAddress = new EmailAddress
|
EmailAddress = new EmailAddress
|
||||||
{
|
{
|
||||||
Address = "frannis@contoso.onmicrosoft.com"
|
Address = _configuration.GetSection("GraphSmtp")["destEmail"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var graphClient = BuildGraphClient();
|
|
||||||
await graphClient.Me.SendMail(message).Request().PostAsync();
|
await graphClient.Me.SendMail(message).Request().PostAsync();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue