I have already used:
user-secret set "AWSAccessKey" "my access key"
and
user-secret set ""AWSSecretKey" "my secret key"
to get my keys into the secret store.
I've got this class that I will be using to send email via Amazon SES, but I don't know how to get my keys into it.
public class MailHelper
{
public void SendEmailSes(string senderAddress, string receiverAddress, string subject, string body)
{
using (var client = new AmazonSimpleEmailServiceClient(
new BasicAWSCredentials("[AWSAccessKey]", "[AWSSecretKey]"),
RegionEndpoint.USEast1))
{
var sendRequest = new SendEmailRequest
{
Source = senderAddress,
Destination = new Destination { ToAddresses = new List<string> { receiverAddress } },
Message = new Message
{
Subject = new Content(subject),
Body = new Body { Text = new Content(body) }
}
};
var response = client.SendEmail(sendRequest);
}
}
}
What do I put in my Startup.cs in order to get those keys available in my MailHelper class? What needs to be added to the MailHelper class itself?
I've seen some examples for MVC Controllers, but I couldn't find anything for custom utility classes that are not already implementing some expected interface.