static void Main(string[] args)
{
if (CheckRequiredFields())
{
using (var client = new AmazonSimpleEmailServiceClient(RegionEndpoint.USEast1))
{
var sendRequest = new SendEmailRequest
{
Source = senderAddress,
Destination = new Destination { ToAddresses = new List<string> { receiverAddress } },
Message = new Message
{
Subject = new Content("Sample Mail using SES"),
Body = new Body { Text = new Content("Sample message content.") }
}
};
try
{
Console.WriteLine("Sending email using AWS SES...");
var response = client.SendEmail(sendRequest);
Console.WriteLine("The email was sent successfully.");
}
catch (Exception ex)
{
Console.WriteLine("The email was not sent.");
Console.WriteLine("Error message: " + ex.Message);
}
}
}
Console.Write("Press any key to continue...");
Console.ReadKey();
}