...
Warning |
---|
|
The attributes "customProperties", "forgetTopHeaders" and "disableTop" are available in version 2008.02 and above only! |
...
Info |
---|
title | Sender endpoint attributes |
---|
borderStyle | solidbgColor='lighblue' |
---|
|
Name | Type | Description | Default |
---|
connection | string | sets the connection information | null (must be spec'd) | sender | string | defines the sender address of the mail | no-reply@localhost | receiver | string | defines the receiver address of the mail | null | marshaler | class | org.apache.servicemix.mail.marshaler.AbstractMailMarshaler | DefaultMailMarshaler | debugMode | boolean | sets the debug mode for the javamail api | false | ignoreMessageProperties | java.util.List | a list TO address in the IN message will be ignored | false | customProperties | java.util.Map | a map of custom properties for the connection | null | customTrustManagers | string | sets one or more custom trust managers for use with ssl | null |
|
Warning |
---|
|
The attributes "customProperties" and "ignoreMessageProperties" are available in version 2008.02 and above only! |
The DefaultMailMarshaler (used if no other is set) will convert in the following way:
...
Warning |
---|
title | Common pitfall regarding the receiver |
---|
|
If you are just setting up a mail-bridge (means just a poller connected to a sender for mail forwarding) you will need to provide a sender property ignoreMessageProperties as List, containing a list of to ignore message properties. Inside you should at least define the org.apache.servicemix.mail.to value, otherwise the receiver will be the receiver of the original mail. That would just forward the original mail to the account you are polling from generating a nice mail loop. Be warned! This property is available in servicemix-mail-2008.02 and above only! If you are using an older version you need to write your own mail marshaler to fix this problem. |
How to use customProperties
Via this attribute you can provide a map of properties which will be applied to the connection properties. Doing so enables you to
completely configure the connection properties.
Code Block |
---|
lang | xml |
---|
title | Polling endpoint with ignored TOP headers (same is also for sender) |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
xmlns:test="http://www.servicemix.org/example"
xmlns:util="http://www.springframework.org/schema/util">
<mail:poller service="test:myMailService"
endpoint="pollerEndpoint"
targetService="test:myMailProcessor"
period="10000"
connection="imap://lhein@testserver:143/INBOX?password=myPass"
deleteProcessedMessages="false"
processOnlyUnseenMessages="true"
customProperties="#customProps"/>
<util:map id="customProps">
<entry key="mail.pop3.forgettopheaders" value="true" />
</util:map>
</beans>
|
For a list of properties used by the SUN implementation influencing the connection have a look at the Mail API documentation:
http://java.sun.com/products/javamail/javadocs/overview-summary.html
Have especially a look at the protocol specific package summaries.
How to use ignoreMessageProperties
Via this property you can provide a list of properties of the normalized in message which will be set to null
before marshaling it. This will enable you for example to have a simple email forward bridge with a poller and a
sender which will forward the received message to a new email address. Without skipping at least the TO address property
the mail would be sent again to the account you are polling from (see how the receiver is determined).
Code Block |
---|
lang | xml |
---|
title | Sending endpoint with skipping the adress fields |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
xmlns:test="http://www.servicemix.org/example"
xmlns:util="http://www.springframework.org/schema/util">
<mail:sender service="test:myMailService"
endpoint="senderEndpoint"
sender="no-reply@servicemix.org"
receiver="testreceiver@targethost.com"
connection="smtp://lhein@testserver?password=myPass"
ignoreMessageProperties="#ignoreProps" />
<util:list id="ignoreProps">
<value>org.apache.servicemix.mail.to</value>
<value>org.apache.servicemix.mail.cc</value>
<value>org.apache.servicemix.mail.bcc</value>
<value>org.apache.servicemix.mail.from</value>
<value>org.apache.servicemix.mail.replyto</value>
</util:list>
</beans>
|
For all xbean file endpoint configuration take a look at Xml schemas
...