skip to Main Content

I am trying to send an email from email1 to email2. But I am getting the following error:

Transaction failed. The server response was: Message rejected: Email address is not verified. The following identities failed the check in region CA-CENTRAL-1: [email protected], Sender Name [email protected], [email protected]

Here is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Net.Mail;

namespace ConsoleApp3
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Email("DO TEST");
        }

        public static void Email(string htmlString)
        {


            String FROM = "[email protected]";
            String FROMNAME = "Sender Name";

    
            String TO = "[email protected]";

  
            String SMTP_USERNAME = "kiffretM5C2PFESI5W";


            String SMTP_PASSWORD = "BLeMDSkjioourdvhvbhvhTMHAVfuG6mcAXibbTmQpe7WX";


            String HOST = "email-smtp.ca-central-1.amazonaws.com";

     
            int PORT = 587;

            
            String SUBJECT =
                "Amazon SES test (SMTP interface accessed using C#)";

            // The body of the email
            String BODY =
                "<h1>Amazon SES Test</h1>" +
                "<p>This email was sent through the " +
                "<a href='https://aws.amazon.com/ses'>Amazon SES</a> SMTP interface " +
                "using the .NET System.Net.Mail library.</p>";

  
            MailMessage message = new MailMessage();
            message.IsBodyHtml = true;
            message.From = new MailAddress(FROM, FROMNAME);
            message.To.Add(new MailAddress(TO));
            message.Subject = SUBJECT;
            message.Body = BODY;
     

            using (var client = new System.Net.Mail.SmtpClient(HOST, PORT))
            {
                
                client.Credentials =
                    new NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);

                
                client.EnableSsl = true;


                try
                {
                    Console.WriteLine("Attempting to send email...");
                    client.Send(message);
                    Console.WriteLine("Email sent!");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("The email was not sent.");
                    Console.WriteLine("Error message: " + ex.Message);
                }
            }
            }
    }
}

2

Answers


  1. It would appear that you are using Amazon SES in sandbox mode.

    From Moving out of the Amazon SES sandbox – Amazon Simple Email Service:

    To help prevent fraud and abuse, and to help protect your reputation as a sender, we apply certain restrictions to new Amazon SES accounts.

    We place all new accounts in the Amazon SES sandbox. While your account is in the sandbox, you can use all of the features of Amazon SES. However, when your account is in the sandbox, we apply the following restrictions to your account:

    • You can only send mail to verified email addresses and domains, or to the Amazon SES mailbox simulator.
    • You can send a maximum of 200 messages per 24-hour period.
    • You can send a maximum of 1 message per second.

    While operating in sandbox mode, you will need to verify every email address before it can receive email.

    Login or Signup to reply.
  2. I had the same problem. I solved it by setting up the VM in google console and display the corresponding code, copied it to a command line, changed –maintenance-policy=MIGRATE to –maintenance-policy=TERMINATE, and created the VM from the command line.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search