Hello, 
i need to send a binary file (zip file for example) as an attachment via
email.
when I get the attachment in my mailbox the file is corrupted.


*here is my config *
as you can see, i set the mime type to application/octet-stream.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:camel="http://camel.apache.org/schema/spring";
        xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
         http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

<camelContext xmlns="http://camel.apache.org/schema/spring";>
  <endpoint id="ompSMTPEndpoint"
uri="smtp://myhost:25?from=myemail&amp;to=myemail" />

  <route>
    <from uri="file:C:\work?initialDelay=5000&amp;delay=300000" />
      <setHeader headerName="Content-Type">
        <simple>application/octet-stream;name="${file:onlyname}";</simple>
      </setHeader>
      <setHeader headerName="Content-Disposition">
       
<simple>attachment;filename="${file:onlyname}";size=${file:size}</simple>
      </setHeader>                              
      <setHeader headerName="subject">
        <simple>Filename ${file:onlyname} date ${date:now:dd/MM/yyyy
HH:mm:ss}</simple>
      </setHeader>
    <to ref="ompSMTPEndpoint" />        
  </route>
  
</camelContext>
</beans>


the mail source code in my mailbox : 
Content-Type: application/octet-stream; name="FILENAME.ZIP"
Content-Disposition: attachment;filename="FILENAME.ZIP";size=11191
Content-Transfer-Encoding: base64

/
 hope i've been brief and clear, thank you for your help/

--
View this message in context: 
http://camel.465427.n5.nabble.com/SMTP-sending-file-binary-as-attachment-corrupted-tp5543701p5543701.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to