I'm trying sent mail with apache Camel with xml. So I build postfix , dovecot and servicemix same server. I wrote below xmlfile. but it doesn't work and occur a error
- precondition
- install Mail Component(camel)
- confirm bundle:list(status:active)
Please teach me how to write xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<!-- -->
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<!-- -->
<route>
<from uri="smtp://localhost?from=testuser01@domain?subject=testmail" />
<to uri="pop3://localhost?to=testuser02@domain" />
</route>
</camelContext>
</blueprint>
You can view the error below:
2018-08-06 00:46:44,007 | ERROR | mix-7.0.0/deploy | BlueprintCamelContext | 40 - org.apache.camel.camel-blueprint - 2.16.4 | Error occurred during starting Camel: CamelContext(camel-3) due Protocol smtp cannot be used for a MailConsumer. Please use another protocol such as pop3 or imap.
============================================
@Namphibian Thank you for your quick reply. I fixed the code and retlied , but didn't work.
You can view the error below
・ERROR
WARN | pop3://IPAddress | MailConsumer | 43 - org.apache.camel.camel-core - 2.16.4 | Consumer Consumer[pop3://IPAddress?to=user%40domain] failed polling endpoint: Endpoint[pop3://IPAddress?to=user%40domain]. Will try again at next poll. Caused by: [javax.mail.AuthenticationFailedException - failed to connect, no user name specified?]
I thougut that I need to wirite username and Password, but didn't work
・CODE
<route>
<from uri="pop3://IPaddress?to=user@domain?username=user@domain?password=password" />
<log message="received the message with this content: ${body}" />
<to uri="smtp://IPaddress?from=admin@domain?subject=testmail" />
</route>
You can view the error below
WARN | pop3://IPAddress | MailConsumer | 43 - org.apache.camel.camel-core - 2.16.4 | Consumer Consumer[pop3://IPAddress?to=user%40domain%3Fusername%3Duser%40domain%3Fpassword%3Duser] failed polling endpoint: Endpoint[pop3://IPAddress?to=user%40domain%3Fusername%3Duser%40domain%3Fpassword%3Duser]. Will try again at next poll. Caused by: [javax.mail.AuthenticationFailedException - failed to connect, no user name specified?]
How should I do to send and receive a mail?
============================================
Refixed code and tried again. But didn't work.
・CODE
<route>
<from uri="pop3://IPaddress?to=user@domain?username=user@domain&password=password" />
<log message="received the message with this content: ${body}" />
<to uri="smtp://IPaddress?from=admin@domain?subject=testmail" />
</route>
・ERROR
WARN | pop3://IPAddress | MailConsumer | 43 - org.apache.camel.camel-core - 2.16.4 | Consumer Consumer[pop3://IPAddress?password=xxxxxx&to=user%40domain%3Fusername%3Duser%40domain] failed polling endpoint: Endpoint[pop3://IPAddress?password=xxxxxx&to=user%40domain%3Fusername%3Duser%40domain]. Will try again at next poll. Caused by: [javax.mail.AuthenticationFailedException - [AUTH] Authentication failed.]
IPAddress
I thougut %40 represents @. Should I fix some special charactor?
I find URL that wrote about how to escape special character. But couldn't find bout "@". http://camel.apache.org/how-do-i-use-uris-with-parameters-in-xml.html