[BUG Probably] SMTP connector sending attchament wiht no name

View: New views
1 Messages — Rating Filter:   Alert me  

[BUG Probably] SMTP connector sending attchament wiht no name

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi:

I'm delveloping a model that reads an XML as input, generate (integrated with JasperReports) a PDF and send it via e-mail (SMTP),
I'm having no problem reading the XML and generating the PDF, but the problem is with the name of the attachment.

I've developed a transformer that generates the PDF and adds it as an attachment to tha mesagge.
                <service name="e3lDocumentService">
                        <inbound>
                                <vm:inbound-endpoint path="e3l.input.document"
                                        encoding="ISO-8859-1">
                                        <transformers>
                                                <transformer ref="AddAttachPdfFile" />
                                        </transformers>
                                </vm:inbound-endpoint>
                        </inbound>
                        <outbound>
                                <chaining-router>
                                        <jdbc:outbound-endpoint queryKey="documentUpdate" />
                                        <smtp:outbound-endpoint host="${smtp.server}">
                                                <transformers>
                                                        <email:object-to-mime-transformer />
                                                </transformers>
                                        </smtp:outbound-endpoint>
                                </chaining-router>
                        </outbound>
                </service>

If I add the attachment from File (transformer AddAttachPdfFile)
     *FileDataSource file = new FileDataSource(new File(fullFileName));*
     *message.addAttachment(otherName, new DataHandler(file));*
the attachment fullFileName is sent, but wiht the name of the file as the name of the email attachment.
I expected it to be the name of the mule attachment, but ... (I can live with this)

The problem is that if I create the attachment on the fly
*byte[] payloadPdf = jrUtils.XmlToPdf(message .getPayloadAsString(), fullReportName);*
*if (payloadPdf != null) {*
* String tipoMIMEDelArray = "application/pdf";*
* ByteArrayDataSource bads = new ByteArrayDataSource(payloadPdf, tipoMIMEDelArray);*
* bads.setName(pdfName);*
* DataSource ds = (DataSource) bads;*
* DataHandler dh = new DataHandler(ds);*
* message.addAttachment(pdfName, dh);*
*}*
the email message is sent, but tha attachment has no name (I see it as "Part 1.2"), but it's the pdf I expected and I can see it perfectly.
So the problema I see is that the SMTP transport (may be more especifically) the <email:object-to-mime-transformer /> is not using the attachment name, no the DataSource name when sending an email with attchment.

Thanks.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email