AmazonSesSample.Program.Main C# (CSharp) 메소드

Main() 정적인 개인적인 메소드

static private Main ( string args ) : void
args string
리턴 void
        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();
        }