Try the below code

from("file:///path/to/file.xyz") 
.process(new Processor(){
@Override
  public void process(Exchange exchange){
    Message in = exchange.getIn();
    byte[] file = in.getBody(byte[].class);
    String fileId = in.getHeader("CamelFileName",String.class);
    in.addAttachment(fileId, new DataHandler(new ByteArrayDataSource(file,
"text/csv")));
  }
})
.to("velocity:///path/to/email-contents.vm") 
to("smtp://mail-details...")



--
View this message in context: 
http://camel.465427.n5.nabble.com/Easily-Send-Files-as-email-attachments-tp5765664p5765667.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to