You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sandra Schweighart <Sa...@Innovations.de> on 2006/03/21 14:47:11 UTC

problem sending MimeMail

Hallo everyone!

I'd like my JBI-Component to use the Email feature of SM.

So I wrote following servicemix.xml -snippet:
"<sm:activationSpecs>
            <sm:activationSpec componentName="emailSender"
service="foo:emailSender">
                  <sm:component>
                      <bean
class="org.apache.servicemix.components.email.MimeMailSender">
                        <property name="sender">
                            <bean
class="org.springframework.mail.javamail.JavaMailSenderImpl">
                                <property name="host" value="mysmtpserver"/>
                                <property name="port" value="25"/>
                                <property name="username"
value="Sandra.Schweighart"/>
                                <property name="password"
value="myPassword"/>
                            </bean>
                        </property>
                      </bean>
                    </sm:component>
                </sm:activationSpec>
    </sm:activationSpecs>
"
And in my component I set all properties and send the MessageExchange
through my channel:
"InOnly inOnly = channel.createExchangeFactory().createInOnlyExchange();
NormalizedMessage mailMessage = inOnly.createMessage();
mailMessage.setProperty("org.servicemix.email.to",
"sandra.schweighart@innovations.de");
mailMessage.setProperty("org.servicemix.email.from",
"sandra.schweighart@innovations.de");
mailMessage.setProperty("org.servicemix.email.text","My Message");
mailMessage.setProperty("org.servicemix.email.subject", "Mail Test");
mailMessage.setProperty("org.servicemix.email.replyTo",
"sandra.schweighart@innovations.de");
 inOnly.setInMessage(mailMessage);

QName service = new
QName("http://www.sandraschweighart.de/services","emailSender");
inOnly.setEndpoint(context.getEndpoint(service, "emailSender"));
channel.send(inOnly);"

But nothing happens. It doesn't send any Email. When I used the SM
2.0.2-version I received an IllegalArgumentException when
MailMarshallerSupport tried to evaluate the "to"-field. So I thought
that SM at least routet to the right service and there was the exception
thrown. Then I took the latest nightly build of SM and now after
"channel.send(inOnly);" nothing happens any more. The component
"emailSender" gets installed. But I miss the message on commandline that
the service "emailSender" has been activated. (it seems that the newer
SM versions don't have that feature any more).

In my oppinion SM doesn't route the message to the emailSender-Service.
Do you have any idea? Where is my mistake?

Greatings
Sandra

Re: problem sending MimeMail

Posted by Jerome Camilleri <je...@bull.net>.
Sandra Schweighart wrote:
> Hallo everyone!
>
> I'd like my JBI-Component to use the Email feature of SM.
>
> So I wrote following servicemix.xml -snippet:
> "<sm:activationSpecs>
>             <sm:activationSpec componentName="emailSender"
> service="foo:emailSender">
>                   <sm:component>
>                       <bean
> class="org.apache.servicemix.components.email.MimeMailSender">
>                         <property name="sender">
>                             <bean
> class="org.springframework.mail.javamail.JavaMailSenderImpl">
>                                 <property name="host" value="mysmtpserver"/>
>                                 <property name="port" value="25"/>
>                                 <property name="username"
> value="Sandra.Schweighart"/>
>                                 <property name="password"
> value="myPassword"/>
>                             </bean>
>                         </property>
>                       </bean>
>                     </sm:component>
>                 </sm:activationSpec>
>     </sm:activationSpecs>
> "
> And in my component I set all properties and send the MessageExchange
> through my channel:
> "InOnly inOnly = channel.createExchangeFactory().createInOnlyExchange();
> NormalizedMessage mailMessage = inOnly.createMessage();
> mailMessage.setProperty("org.servicemix.email.to",
> "sandra.schweighart@innovations.de");
> mailMessage.setProperty("org.servicemix.email.from",
> "sandra.schweighart@innovations.de");
> mailMessage.setProperty("org.servicemix.email.text","My Message");
> mailMessage.setProperty("org.servicemix.email.subject", "Mail Test");
> mailMessage.setProperty("org.servicemix.email.replyTo",
> "sandra.schweighart@innovations.de");
>  inOnly.setInMessage(mailMessage);
>
> QName service = new
> QName("http://www.sandraschweighart.de/services","emailSender");
> inOnly.setEndpoint(context.getEndpoint(service, "emailSender"));
> channel.send(inOnly);"
>
> But nothing happens. It doesn't send any Email. When I used the SM
> 2.0.2-version I received an IllegalArgumentException when
> MailMarshallerSupport tried to evaluate the "to"-field. So I thought
> that SM at least routet to the right service and there was the exception
> thrown. Then I took the latest nightly build of SM and now after
> "channel.send(inOnly);" nothing happens any more. The component
> "emailSender" gets installed. But I miss the message on commandline that
> the service "emailSender" has been activated. (it seems that the newer
> SM versions don't have that feature any more).
>
> In my oppinion SM doesn't route the message to the emailSender-Service.
> Do you have any idea? Where is my mistake?
>   
I have this sort of problem too.
Do you try to switch your log level to DEBUG 
($SERVICE_MIX/conf/log4j.conf : <root> <level value="DEBUG"/>)

Into a lot of debug trace (ERROR level can't catch this kind of error), 
you can find a javax.mail.NoSuchProviderException exception :

DEBUG - DeliveryChannelImpl.traceMessageExchange(342) | Sent: 
MessageExchange[
  id: ID:frec445368-46122-1143724870315-10:4
  status: Error
  role: provider
  service: {http://servicemix.apache.org/demo/}emailSender
  endpoint: emailSender
  in: <?xml version="1.0" encoding="UTF-8"?><timer><name>My Example Job 
timer1</name><group>ServiceMix1</group><fullname>ServiceMix1.My Example 
Job timer1</fullname><description/><fireTime>Thu Mar 30 15:21:20 CEST 
2006</fireTime></timer>
  error: org.springframework.mail.MailSendException: Mail server 
connection failed; nested exception is 
javax.mail.NoSuchProviderException: Unable to locate provider for 
protocol: smtp

Regards,

Jérôme