title: Send Email with Camel an Java. ISSUE STARTTLS error
body: <p>I know this question has been asked before, but I tried several sollutions and the problem still persists, so and help would be much appreciated.</p>
  
  <p>I am trying to configure to send email throu gmail and smtp. Below is our camel configuration:</p>
  
  <pre><code>&lt;camel:camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
  
      &lt;camel:route id="gmailRoute"&gt;
          &lt;camel:from uri="direct://gmail" /&gt;
          &lt;camel:to
              uri="smtp://p****is@gmail.com?host=smtp.gmail.com&amp;amp;port=587&amp;amp;from=p****is@gmail.comi&amp;amp;password=gl******" /&gt;
      &lt;/camel:route&gt;
  </code></pre>
  
  <p>On the init method of our service implementation we have the following:</p>
  
  <pre><code>   log.info("Initializing Email Service");
  
      Properties props = new Properties();
      props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
      props.put("mail.smtp.auth", "true");
      props.put("mail.smtp.starttls.enable", "true");
      props.put("mail.smtp.host", "smtp.googlemail.com");
      props.put("mail.smtp.port", "587");
      Authenticator auth = null;
          props.put("mail.smtp.auth", "true");
          auth = new Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                  return new PasswordAuthentication("******akis@gmail.com", "gl*****s");
              }
          };
      Session t = Session.getInstance(props, auth);
  
      template = camelContext.createProducerTemplate();
  </code></pre>
  
  <p>and on the sendmail method we have:</p>
  
  <pre><code>  @Override
  public void sendEmail(String from, String[] to, String[] cc, String[] bcc, String subject, String body)
  {
  String endpoint = "direct://gmail";
      String toString = null;
      String ccString = null;
      String bccString = null;
      Map&lt;String, Object&gt; headers = null;
  
      toString = convertStringArrayToCSV(to);
      ccString = convertStringArrayToCSV(cc);
      bccString = convertStringArrayToCSV(bcc);
  
      headers = new HashMap&lt;String, Object&gt;();
      headers.put("Subject", subject);
      if (toString != null)
      {
          headers.put("To", toString);
      }
  
      if (ccString != null)
      {
          headers.put("CC", ccString);
      }
  
      if (bccString != null)
      {
          headers.put("BCC", bccString);
      }
  
      template.sendBodyAndHeaders(endpoint, body, headers);
  
  }
  </code></pre>
  
  <p>the problem is that when we try to send an email using the sendmail method we get the following error:</p>
  
  <blockquote>
    <p>caught: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first.</p>
  </blockquote>
  
  <p>any ideas would be much appreciated.</p>