The following test works for me:

package org.apache.camel.component.mail;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class GMailProducerTest extends CamelTestSupport {

    @Test
    public void testProduer() throws Exception {
        getMockEndpoint("mock:result").expectedMessageCount(1);

        template.sendBodyAndHeader("direct:start", "Message ", "To", "
firstname.lastn...@gmail.com");

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")
                    .to("smtps://
smtp.gmail.com:465?username=firstname.lastn...@gmail.com&password=*****&debugMode=true",
"mock:result");
            }
        };
    }
}

Best,
Christian
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Mon, Aug 12, 2013 at 10:43 PM, silviolucasfilho <slpere...@hotmail.com>wrote:

> I´m using the mail component to send an email usign gmail as relay and I
> receive the following error all the time:
>
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host:
> smtp.gmail.com, port: 587;
>   nested exception is:
>         javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
> connection?
>         at
> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
> [mail-1.4.5-redhat-1.jar:1.4.5-redhat-1]
>
> I´m using the following route configuration (I´m using DSL route
> configuration):
>
>
>         from(START_INSTALLER)
>              .log(">> Init Installer.")
>              .to("bean:installRoles?method=installAdmin")
>              .to("bean:installRoles?method=installUser")
>              .to("bean:installRootUser?method=installRoot")
>
> .to("smtps://
> smtp.gmail.com:587?username=te...@gmail.com&password=teste&debugMode=true&to=${body.email}&mail.smtp.starttls.enable=true
> ")
>              .log(">> End Route.");
>
> Can anybody help-me?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Can-t-send-mail-using-gmail-smtp-server-using-caml-smtps-component-javax-net-ssl-SSLException-Unreco-tp5737177.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to