Problem win Amaser SES

I am using amazon SES SMTP for sending mail, But I am getting error "Unable to read data from the transport connection: net_io_connectionclosed

Here is my code:
const String FROM = "support@dynamiclevels.com";   // Replace with your "From" address. This address must be verified.
            const String TO = "anwesha@dynamiclevels.COM";  // Replace with a "To" address. If your account is still in the
            // sandbox, this address must be verified.

            const String SUBJECT = "Amazon SES test (SMTP interface accessed using C#)";
            const String BODY = "This email was sent through the Amazon SES SMTP interface by using C#.";

            // Supply your SMTP credentials below. Note that your SMTP credentials are different from your AWS credentials.
            const String SMTP_USERNAME = "USERNAME";  // Replace with your SMTP username.
            const String SMTP_PASSWORD = "PASSWORD";  // Replace with your SMTP password.

            // Amazon SES SMTP host name. This example uses the US West (Oregon) region.
            const String HOST_SES = "email-smtp.us-east-1.amazonaws.com";

            // Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
            // STARTTLS to encrypt the connection.
            const int PORT = 465;

            // Create an SMTP client with the specified host name and port.
            SmtpClient client = new System.Net.Mail.SmtpClient(HOST_SES, PORT);

            // Create a network credential with your SMTP user name and password.
            client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
           
            // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
            // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
            client.EnableSsl = true;

            // Send the email.
            try
            {
                Console.WriteLine("Attempting to send an email through the Amazon SES SMTP interface...");
                client.Send(FROM, TO, SUBJECT, BODY);
                Console.WriteLine("Email sent!");
            }
            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();
LVL 1
dynamicweb09Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

apeterCommented:
Try using the port 587 instead of 465 since it is ssl connection.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dynamicweb09Author Commented:
Thanks for the solution . Using 587 it works fine.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AWS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.