Kaigo
Kaigo

Reputation: 1599

Sending email with camel

I'm having issues sending an email out through camel with the java dsl. I've been using the camel mail guide but I receive the following error.

Caused by: [com.sun.mail.util.MailConnectException - Couldn't connect to host, port: smtp.google.com, 25; timeout 30000]

Here is what I have in my route

    from("timer://foo?period=5000")  // Create a message every 5 seconds
            .setHeader("subject", simple("hello from camel"))
            .setBody(simple("camel"))
            .log("sending?")
            .to("smtps://smtp.google.com?password=mypass123&[email protected]&[email protected]&[email protected]");

The email service is actually provided by gmail. Now I did see a gmail plugin, but its pretty tough to find an example, so I thought I would use the standard method for now. But if someone knows the solution using it, I welcome it!

PS. I have camel-mail dependency and thecamel-google-mail which I'm not using.

Versions 2.20.2

Upvotes: 1

Views: 2037

Answers (1)

Kaigo
Kaigo

Reputation: 1599

It was due to less secure apps not fully being turned off.

Use this link here https://www.google.com/settings/security/lesssecureapps

Also some of the silly mistakes pointed out in the comments.

Thanks!

Upvotes: 1

Related Questions