I'm working with an Azure mobile services backend and I can send an email successfully via SendGrid. However, each time I try to add an attachment, it fails. I never receive the email. After a little research, I found out that all I needed was a virtual path. I modified the path name but it still does not work.
I can't seem to figure out why this fails.
Below is my code:
var client = new SendGridClient("apiKey");
var msg = new SendGridMessage()
{
From = new EmailAddress(sender),
Subject = "Adherence Report",
PlainTextContent = "Sample Content ",
HtmlContent = "<strong>Hello, Email!</strong>"
};
msg.AddTo(new EmailAddress(receipient, null));
msg.AddAttachment(@"~\sample\adherence.csv", "Testing", null, null, null);
var response = await client.SendEmailAsync(msg);
response
?