title: Amazon sesThrottling – Maximum sending rate exceeded
body: <p>As per what this <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/reach-sending-limits.html" rel="nofollow">documentation</a> says, if I reach the max send rate, I will get an error. My max send rate is 14 emails per second and I tried to send 100 mails concurrenlty, all the emails arrived to the recipient.</p>
  
  <p>So I wonder why Amazon SES didn't send any "signal" complaining about my excess or easier, why Amazon SES did deliver all those 100 emails when it was supposed to send only 14.</p>
  
  <p>Here is the code I used:</p>
  
  <pre><code>    List&lt;String&gt; destinations = new ArrayList&lt;&gt;(); //replace with your TO email addresses
  
      for (int i = 0; i &lt; 100; i++) {
          destinations.add("Receiver address");
      }
      int i=0;
      for (String destination : destinations) {
  
          new Thread("" + i){
              public void run(){
                  System.out.println("Thread: " + getName() + " running");
                  int maxRetries = 10;
                  while(maxRetries--&gt;0) {
                      try {
                          // Create the subject and body of the message.
                          Content subject = new Content().withData("Asunto");
                          Content textBody = new Content().withData("cuerpo");
                          Body body = new Body().withText(textBody);
  
                          // Create a message with the specified subject and body.
                          Message message = new Message().withSubject(subject).withBody(body);
                          Destination destination2 = new Destination().withToAddresses(new String[]{destination});
                          // Assemble the email.
                          SendEmailRequest request = new SendEmailRequest().withSource("fromnaddres").withDestination(destination2).withMessage(message);
  
                          //wait for a permit to become available
                          //rateLimiter.acquire();
  
                          //call Amazon SES to send the message
                          SendEmailResult result = client.sendEmail(request);
                          System.out.println("sent "+result.getMessageId());
                          break;
                      } catch (AmazonServiceException e) {
                          //retries only throttling errors
                          System.out.println("hola");
                          if ("Throttling".equals(e.getErrorCode())  &amp;&amp; "Maximum sending rate exceeded.".equals(e.getMessage())) {
                              System.out.println("Maximum send rate exceeded when sending email to "+destination+". "
                                      +(maxRetries&gt;1?"Will retry.":"Will not retry.") );
                          } else {
                              System.out.println("Unable to send email to: "+destination+". " +e.toString());
                              break;
                          }
                      } catch(Exception e) {
                          System.out.println("Unable to send email to: "+destination+". " +e.toString());
                          break;
                      }
                  }
              }
          }.start();
  
          i++;
      }
  </code></pre>