0

I have a local SMTP server, implemented in the Python core scripts, which simply prints the body of the email received :

python -m smtpd -n -c DebuggingServer localhost:3333. (on Windows)

When I telnet localhost 3333, the connection succeeds and I can send an email using SMTP.

However, when I build (via Java DSL) a route with an endpoint producer to this same address, the connection fails and sends an exception

.to("smtp://localhost:3333");

Part of the exception is :

javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 3333;
  nested exception is:
    java.net.ConnectException: Connection refused: connect
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
    at javax.mail.Service.connect(Service.java:295)
    at org.apache.camel.component.mail.DefaultJavaMailSender.send(DefaultJavaMailSender.java:111)
    at org.apache.camel.component.mail.MailProducer.process(MailProducer.java:56)

Any idea on what is going on ? The process hosting the CamelContext is on the same machine as the telnet client.

Gordak
  • 2,060
  • 22
  • 32

1 Answers1

1

Can you check will it work if you will use "127.0.0.1" instead of "localhost"?

Vyacheslav Enis
  • 1,676
  • 12
  • 17