You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by aha001 <ah...@yahoo.com> on 2007/11/20 03:19:36 UTC
servicemix - Problem sending MineMail
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",
"sample@sample.co.nz");
message.setProperty("org.apache.servicemix.email.from",
"sample@sample.co.nz");
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.
Re: servicemix - Problem sending MineMail
Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,
Can you retry after setting the container's logging level to DEBUG
(http://servicemix.apache.org/how-do-i-change-the-logging.html) to check
if this gives us any additional information about what has gone wrong?
Also, could you check the exchange's properties after the call to
sendSync? You might have a Fault message in there or the status can be
ERROR instead of DONE.
Gert
aha001 wrote:
> 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",
> "sample@sample.co.nz");
> message.setProperty("org.apache.servicemix.email.from",
> "sample@sample.co.nz");
> 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)
> }
>
>