Announcement Announcement Module
Collapse
No announcement yet.
Send File using email channel Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Send File using email channel

    Hi All,

    I have problem with sending File using email channel. The problem is i have to send File plus it's metadata such ash timestamp, md5 checksum, size, it's name and number of file sent per session. For example i want to send 3 file, so for each data sent to email, i have to provide what is number of file i sent, sending numFile data actually can be avoided if i just zip all file in one zip file, but i guess it's too big to sent one zip file over email.

    So far actually i made a lot of workaround, for instance i put numFile and MD5 checksum data in MailHeaders.REPLY_TO field.

    I wonder if there any tidy mechanism to do this? there is a built in transformer for string payload message through email channel : <mail:mail-to-string-transformer> so it's realy easy to get a string from email. But if i send a byte[] from File plus it's metadata there is no apropriate transformer to get it from GenericMessage.

    So i have to wrote custom transformer to get byte[] and it's metadata from GenericMessage<MimeMessage>, and hell it needs days to make it right , and my code is completely messy.

    I plan to create a class to wrap byte[] plus it's metadata, forexample :


    public class DataFile implements Serializable {

    static final long serialVersionUID = -6618469841127325812L;

    private String md5;
    private Long timestamp;
    private Long size;
    private byte[] file;
    private String filename;
    private Integer numFile;
    }

    then Serialize class DataFile to byte[]. But still i dont fine any built in transformer to transform GenericMessage<MimeMessage> to byte[]. Even if i get it right still i need to dig deep to javamail example to findout how to pull a byte[] attachment from MimeMessage.

    So, can i make a request of a built in transformer called <mail:mail-to-byte-arry> ?

    thank you
Working...
X