Ok, first of all mail header enricher is used to send mail not to receive.
For your use case (routing based on the subject) there are quite a few simple ways. Here is a couple.
1. Header Enricher -> Header Value Router
Code:
<int:header-enricher input-channel="mailReceiveChannel" output-channel="routingChannel">
<int:header name="SUBJECT" expression="payload.getSubject()"/>
</int:header-enricher>
<int:header-value-router input-channel="mailReceiveChannel" header-name="SUBJECT">
<int:mapping channel="channelA" value="TICKET-100"/>
<int:mapping channel="channelB" value="TICKET-200"/>
</int:header-value-router>
Since the payload of the Message is a MimeMessage you can simply execute payload.getSubject() using SpEL and set it as SUBJECT header. Then use HeaderValueRouter and route based on the value of SUBJECT header.
2. RecipientListRouter with selector expression
Code:
<int:recipient-list-router input-channel="mailReceiveChannel">
<int:recipient channel="ticket100-channel" selector-expression="payload.getSubject().endsWith('100')"/>
<int:recipient channel="ticket100-channel" selector-expression="payload.getSubject().endsWith('200')"/>
</int:recipient-list-router>
If your selection/routing logic is simple enough to be handled by SpEL, then as you can see a simple selector-expression would eliminate the need for enriching the headers and instead use recipient-list-router with boolean SpEL expression thus still routing to a single channel.