I would like to use the lwcontainer to send email.

I configured the servicemix.xml file for the su as below:

The code was running without error but I don’t see the email. Does it
actually send?

Help will be much appreciates.

<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
xmlns:no="http://telecom.co.nz/eai/af/notify";>
   <sm:serviceunit id="jbi">
        <sm:activationSpecs>
             <sm:activationSpec componentName="mimeSender"
service="no:SendNotification" endpoint="endpoint">
        <sm:component>
        <bean class="org.apache.servicemix.components.email.MimeMailSender">
                                                <property name="sender">
                                                <bean 
class="org.springframework.mail.javamail.JavaMailSenderImpl">
                                                <property name="host" 
value="146.171.1.1"/>
                                                <property name="port" 
value="25"/>
                                                </bean>
                                                </property>
   </bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:serviceunit>
</beans>

and the code:

public void sendEmail(ComponentContext context) throws NamingException,
JBIException{
       
        
ServiceMixClient client = new ServiceMixClientFacade(context);
QName service = new QName("http://telecom.co.nz/eai/af/notify";,
"SendNotification");
EndpointResolver resolver = client.createResolverForService(service); 
ServiceEndpoint se = client.getContext().getEndpoint(service, "endpoint"); 
InOnly exchange;
exchange = client.createInOnlyExchange(resolver);
exchange.setOperation(service);
NormalizedMessage message = exchange.createMessage();
message.setProperty("org.apache.servicemix.email.to",
"[EMAIL PROTECTED]");
message.setProperty("org.apache.servicemix.email.from",
"[EMAIL PROTECTED]");
message.setProperty("org.apache.servicemix.email.subject", "Hello from
sendEmail");
message.setProperty("org.apache.servicemix.email.text", "Hi from test
sendEmail");
message.setContent(new
StringSource("<setContext><ComponentContext>Testing</ComponentContext></setContext>"));
        
client.sendSync(exchange)
}

-- 
View this message in context: 
http://www.nabble.com/servicemix---Problem-sending-MineMail-tf4840815s12049.html#a13849706
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to