I'm trying to use Mailjet to send emails from my .net7 web app however, as stated in the title the above using statement is not being used, I've checked the mailjet.api nuget package is up to date and I've also uninstalled & reinstalled it but still no joy. Does anyone know how to solve this or am I being a muppet and missed something in my code?
using System.Threading.Tasks;
using Mailjet.Client;
using Mailjet.Client.Resources;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json.Linq;
namespace SerialTrack.Utility
{
public class EmailSender : IEmailSender
{
private readonly IConfiguration _configuration;
private readonly MailJetSettings _mailJetSettings;
public EmailSender(IConfiguration configuration)
{
_configuration = configuration;
_mailJetSettings = new MailJetSettings
{
ApiKey = Wc.MailjetKey,
SecretKey = Wc.MailjetSecret
};
}
public async Task SendEmailAsync(string email, string subject, string htmlMessage)
{
var client = new MailjetClient(_mailJetSettings.ApiKey, _mailJetSettings.SecretKey);
var emailSender = new MailjetEmailSender(client);
var message = new MailjetMessage
{
From = new MailjetRecipient
{
Email = "staff@company.io",
Name = "Admin Team"
},
To = new MailjetRecipient[] { new MailjetRecipient { Email = email } },
Subject = subject,
HTMLPart = htmlMessage
};
await emailSender.SendAsync(message);
}
}
}
I know the using statement is present but in my IDE, its greyed out to indicate its not in use, if it helps I'm using JetBrains Rider as my IDE.
"using Mailjet.Client.Resources;" is greyed out because actually there is nothing used from that namespace in the code (at least in the fragment of code that is posted)
I'm trying to use Mailjet to send emails from my .net7 web app however, as stated in the title the above using statement is not being used, I've checked the mailjet.api nuget package is up to date and I've also uninstalled & reinstalled it but still no joy. Does anyone know how to solve this or am I being a muppet and missed something in my code?
using System.Threading.Tasks; using Mailjet.Client; using Mailjet.Client.Resources; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.Extensions.Configuration; using Newtonsoft.Json.Linq;
namespace SerialTrack.Utility { public class EmailSender : IEmailSender { private readonly IConfiguration _configuration; private readonly MailJetSettings _mailJetSettings;
}
I know the using statement is present but in my IDE, its greyed out to indicate its not in use, if it helps I'm using JetBrains Rider as my IDE.