You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kalber <Ka...@swslt.com> on 2014/01/23 15:30:59 UTC

Mail attachment, zip files goes to message body

Hi,

i try to send a zip file as an attachment in a mail, but it finished in the
message body, see below.

In a bean i  attach the zip file to the message with this code :

exchange.getIn().addAttachment(filename,new DataHandler(new
FileDataSource(pathname)));

and then i try to set the content type for the mail endpoint with  a
ContentTypeResolve :

	MailEndpoint sendMail = (MailEndpoint) exchange.getContext()
				.getEndpoint(ReceiveRoute.sendMail);
		sendMail.setContentTypeResolver(new AttachmentContentType(
				"multipart/form-data"));

 	
Nothing to do, the zip file is still in body message.

Some body has an idea what's wrong?

Thanks 
kh



------=_Part_0_1225759642.1390484383704
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Sasa, received file orarioSASA_20131215.zip
------=_Part_0_1225759642.1390484383704
Content-Type: text/plain; name=orarioSASA_20131215.zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=orarioSASA_20131215.zip

UEsDBBQAAAAIAER5hUOtuR1tW2QJAJkGLwAbAAAAb3JhcmlQYXNzYWdnaW9fMjAxMzEyMTUuY3N2
dJ1JkiO6rmTnZfb3wr55d//7qowQ4SAOFZMc0FMKORsQRJv/myn913Pu/+X/8vpfn/9L6f/+X7bh
8V/5HV5xeP5Xvw2v/9rv8I7D+79/3/4zFobT/m/8Dud7OJX63/wdLvdw7fm/9Ttc4/8e/+1vw//+
b/odb/Fv/vt9+Xe8x/F/LMvv+Ijj//5z/R0P85L2vz/afsdXHP/30/u38X+DH7I7jv/78l+2OcXx
fz/+l27+TE4Jy9T+V2cc/l2mf8MrDv8u0zv8u0z/hncc/l2m9r+WwvBnmf4Nh19ylunfcLmHzzL9
G67xf/8u0zv8WaZ/4y3+zc8y/RvvcfyzTP/GRxz/LNO/8TAvtkz/xlcc/yzTO/5Zpn/jO45/lqn9
r6c4/lmmf+Ofyan/DY3/Y2b/XcP5Z5ne4fKzTOn5kvazTO/w+Fmmf8MlDq+fZfo3XO/h/O+f+Tvc



-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Mail-attachment-zip-files-goes-to-message-body-tp5746400.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail attachment, zip files goes to message body

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 30, 2014 at 11:33 AM, kalber <Ka...@swslt.com> wrote:
> Hi
> thanks for response,  my problem was ( and this also on log4j )
> that i had  geronimo-mail.jar on my classpath.
>
> Excluding it, work's fine.
>

Ah thanks for sharing your solution. Yeah favor using javax mail JAR
that works well.


> thanks
> karlheinz
>
>
>
> -----
> kh
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-attachment-zip-files-goes-to-message-body-tp5746400p5746620.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Mail attachment, zip files goes to message body

Posted by kalber <Ka...@swslt.com>.
Hi
thanks for response,  my problem was ( and this also on log4j )
that i had  geronimo-mail.jar on my classpath.

Excluding it, work's fine.

thanks
karlheinz



-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Mail-attachment-zip-files-goes-to-message-body-tp5746400p5746620.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail attachment, zip files goes to message body

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What do you mean the zip file is in the message body?

File attachments to mail messages are in the body, there is no other
places they can be. They just have that disposition part stuff.

A search on the web I could find this
http://email.about.com/cs/standards/a/mime.htm


On Thu, Jan 23, 2014 at 3:30 PM, kalber <Ka...@swslt.com> wrote:
> Hi,
>
> i try to send a zip file as an attachment in a mail, but it finished in the
> message body, see below.
>
> In a bean i  attach the zip file to the message with this code :
>
> exchange.getIn().addAttachment(filename,new DataHandler(new
> FileDataSource(pathname)));
>
> and then i try to set the content type for the mail endpoint with  a
> ContentTypeResolve :
>
>         MailEndpoint sendMail = (MailEndpoint) exchange.getContext()
>                                 .getEndpoint(ReceiveRoute.sendMail);
>                 sendMail.setContentTypeResolver(new AttachmentContentType(
>                                 "multipart/form-data"));
>
>
> Nothing to do, the zip file is still in body message.
>
> Some body has an idea what's wrong?
>
> Thanks
> kh
>
>
>
> ------=_Part_0_1225759642.1390484383704
> Content-Type: text/plain
> Content-Transfer-Encoding: 7bit
>
> Sasa, received file orarioSASA_20131215.zip
> ------=_Part_0_1225759642.1390484383704
> Content-Type: text/plain; name=orarioSASA_20131215.zip
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment; filename=orarioSASA_20131215.zip
>
> UEsDBBQAAAAIAER5hUOtuR1tW2QJAJkGLwAbAAAAb3JhcmlQYXNzYWdnaW9fMjAxMzEyMTUuY3N2
> dJ1JkiO6rmTnZfb3wr55d//7qowQ4SAOFZMc0FMKORsQRJv/myn913Pu/+X/8vpfn/9L6f/+X7bh
> 8V/5HV5xeP5Xvw2v/9rv8I7D+79/3/4zFobT/m/8Dud7OJX63/wdLvdw7fm/9Ttc4/8e/+1vw//+
> b/odb/Fv/vt9+Xe8x/F/LMvv+Ijj//5z/R0P85L2vz/afsdXHP/30/u38X+DH7I7jv/78l+2OcXx
> fz/+l27+TE4Jy9T+V2cc/l2mf8MrDv8u0zv8u0z/hncc/l2m9r+WwvBnmf4Nh19ylunfcLmHzzL9
> G67xf/8u0zv8WaZ/4y3+zc8y/RvvcfyzTP/GRxz/LNO/8TAvtkz/xlcc/yzTO/5Zpn/jO45/lqn9
> r6c4/lmmf+Ofyan/DY3/Y2b/XcP5Z5ne4fKzTOn5kvazTO/w+Fmmf8MlDq+fZfo3XO/h/O+f+Tvc
>
>
>
> -----
> kh
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mail-attachment-zip-files-goes-to-message-body-tp5746400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io