You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by subh <su...@aol.com> on 2009/07/10 05:05:24 UTC

Servicemix Mail Question

I am using FUSE ESB 3.4.0.2.

I am trying to send email using the SMX mail component, my flow is like this

Quartz SU --> SMX Bean (read some files) --> SMX Mail (uses the files read
by bean as attachment)

I am able to send the email, the attachment also is fine but I am not sure
how to set the subject of the email as well as change the file name.

Right now the subject comes as 'no subject' and the attached file name comes
as 'unused' and without the file extension.
-- 
View this message in context: http://www.nabble.com/Servicemix-Mail-Question-tp24421110p24421110.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Servicemix Mail Question

Posted by Lars Heinemann <lh...@apache.org>.
Well, it's a quite simple mistake you did.
The customProperties are used only to modify the connection
properties. This map
has nothing to do with the mail message properties.
Please set the subject and text as properties of the normalized
message you send to the mail sender endpoint.
(that should be done in your bean endpoint)

Regards
Lars



2009/7/10 subh <su...@aol.com>:
>
> Hi Lars,
>
> Thanks for the help.
>
> I was able to set the file name, but I am not able to set the subject. This
> is what I did
>
> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
>       xmlns:orderservice="http://services.fuelquest.com/orderservice"
>       xmlns:util="http://www.springframework.org/schema/util">
>
>    <mail:sender service="orderservice:emailservice"
>                 endpoint="senderEndpoint"
>                 sender="${email.sender}"
>                 receiver="${email.receiver}"
>                 debugMode="false"
>                 connection="${smtp.url}"
>                 customProperties="#customProps"/>
>
>        <util:map id="customProps">
>            <entry key="org.apache.servicemix.mail.subject"
> value="${email.subject}" />
>            <entry key="org.apache.servicemix.mail.text" value="${email.body}" />
>        </util:map>
>
>    <!--Helps configuring bean values through .properties files.-->
>        <bean id="propertyPlaceholder"
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>        <property name="location"
> value="classpath:orsesbservice-email.properties" />
>        </bean>
>
> </beans>
>
> I have specified the subject and the body of the email message in the
> properties file.
>
> I still get the subject as 'no subject'
>
> Regards
> Subh
>
> lhein wrote:
>>
>> Hi,
>>
>> regarding to the component wiki
>> (http://servicemix.apache.org/servicemix-mail.html) you simply set
>> the property "org.apache.servicemix.mail.subject " with an appropriate
>> string value on the normalized message
>> you send to the mail sender. For the file name you should make sure,
>> that you are using something like
>>
>>    File yourFile = ...;
>>    nmsg.addAttachment(yourFile.getName(), new DataHandler(new
>> FileDataSource(yourFile)));
>>
>> That should make sure the mail sender interpretes the name of the file
>> correctly.
>>
>> Hope this helps, otherwise just ping me again.
>>
>> Regards
>> Lars
>>
>>
>> 2009/7/10 subh <su...@aol.com>:
>>>
>>> I am using FUSE ESB 3.4.0.2.
>>>
>>> I am trying to send email using the SMX mail component, my flow is like
>>> this
>>>
>>> Quartz SU --> SMX Bean (read some files) --> SMX Mail (uses the files
>>> read
>>> by bean as attachment)
>>>
>>> I am able to send the email, the attachment also is fine but I am not
>>> sure
>>> how to set the subject of the email as well as change the file name.
>>>
>>> Right now the subject comes as 'no subject' and the attached file name
>>> comes
>>> as 'unused' and without the file extension.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Servicemix-Mail-Question-tp24421110p24421110.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> http://lhein.blogspot.com
>>
>>
>> -----
>> Regards
>> Lars
>>
>>
>> http://lhein.blogspot.com
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Servicemix-Mail-Question-tp24421110p24432175.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
http://lhein.blogspot.com

Re: Servicemix Mail Question

Posted by subh <su...@aol.com>.
Hi Lars,

Thanks for the help.

I was able to set the file name, but I am not able to set the subject. This
is what I did

<beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
       xmlns:orderservice="http://services.fuelquest.com/orderservice"
       xmlns:util="http://www.springframework.org/schema/util">
       
    <mail:sender service="orderservice:emailservice" 
                 endpoint="senderEndpoint"
                 sender="${email.sender}"
                 receiver="${email.receiver}"
                 debugMode="false" 
                 connection="${smtp.url}" 
                 customProperties="#customProps"/>
                 
	<util:map id="customProps">
	    <entry key="org.apache.servicemix.mail.subject"
value="${email.subject}" />
	    <entry key="org.apache.servicemix.mail.text" value="${email.body}" />	    
	</util:map>
                 
    <!--Helps configuring bean values through .properties files.--> 
  	<bean id="propertyPlaceholder"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
       	<property name="location"
value="classpath:orsesbservice-email.properties" /> 
  	</bean>
  	
</beans>

I have specified the subject and the body of the email message in the
properties file.

I still get the subject as 'no subject'

Regards
Subh

lhein wrote:
> 
> Hi,
> 
> regarding to the component wiki
> (http://servicemix.apache.org/servicemix-mail.html) you simply set
> the property "org.apache.servicemix.mail.subject " with an appropriate
> string value on the normalized message
> you send to the mail sender. For the file name you should make sure,
> that you are using something like
> 
>    File yourFile = ...;
>    nmsg.addAttachment(yourFile.getName(), new DataHandler(new
> FileDataSource(yourFile)));
> 
> That should make sure the mail sender interpretes the name of the file
> correctly.
> 
> Hope this helps, otherwise just ping me again.
> 
> Regards
> Lars
> 
> 
> 2009/7/10 subh <su...@aol.com>:
>>
>> I am using FUSE ESB 3.4.0.2.
>>
>> I am trying to send email using the SMX mail component, my flow is like
>> this
>>
>> Quartz SU --> SMX Bean (read some files) --> SMX Mail (uses the files
>> read
>> by bean as attachment)
>>
>> I am able to send the email, the attachment also is fine but I am not
>> sure
>> how to set the subject of the email as well as change the file name.
>>
>> Right now the subject comes as 'no subject' and the attached file name
>> comes
>> as 'unused' and without the file extension.
>> --
>> View this message in context:
>> http://www.nabble.com/Servicemix-Mail-Question-tp24421110p24421110.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> http://lhein.blogspot.com
> 
> 
> -----
> Regards 
> Lars 
> 
> 
> http://lhein.blogspot.com 
> 
> 

-- 
View this message in context: http://www.nabble.com/Servicemix-Mail-Question-tp24421110p24432175.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Servicemix Mail Question

Posted by Lars Heinemann <lh...@apache.org>.
Hi,

regarding to the component wiki
(http://servicemix.apache.org/servicemix-mail.html) you simply set
the property "org.apache.servicemix.mail.subject " with an appropriate
string value on the normalized message
you send to the mail sender. For the file name you should make sure,
that you are using something like

   File yourFile = ...;
   nmsg.addAttachment(yourFile.getName(), new DataHandler(new
FileDataSource(yourFile)));

That should make sure the mail sender interpretes the name of the file
correctly.

Hope this helps, otherwise just ping me again.

Regards
Lars


2009/7/10 subh <su...@aol.com>:
>
> I am using FUSE ESB 3.4.0.2.
>
> I am trying to send email using the SMX mail component, my flow is like this
>
> Quartz SU --> SMX Bean (read some files) --> SMX Mail (uses the files read
> by bean as attachment)
>
> I am able to send the email, the attachment also is fine but I am not sure
> how to set the subject of the email as well as change the file name.
>
> Right now the subject comes as 'no subject' and the attached file name comes
> as 'unused' and without the file extension.
> --
> View this message in context: http://www.nabble.com/Servicemix-Mail-Question-tp24421110p24421110.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
http://lhein.blogspot.com