[mule-jira] Created: (MULE-4601) EMAIL ObjectToMIMETransformer not using attachment name nor DataSource name, when attaching not from File

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

[mule-jira] Created: (MULE-4601) EMAIL ObjectToMIMETransformer not using attachment name nor DataSource name, when attaching not from File

by JIRA no-reply@mulesource.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

EMAIL ObjectToMIMETransformer not using attachment name nor DataSource name, when attaching not from File
---------------------------------------------------------------------------------------------------------

                 Key: MULE-4601
                 URL: http://www.mulesource.org/jira/browse/MULE-4601
             Project: Mule
          Issue Type: Bug
          Components: Core: Transformers, Core: Transports
    Affects Versions: 2.2.1
         Environment: Windows XP, using Mule Standalone
            Reporter: Javier Garcia


If adding a attachment from a byte array (for example, from a PDF generated through JasperReports) to MuleMesagge, the attchment sent by SMTP has no name.
The code the transformer does is:
    protected BodyPart getBodyPartForAttachment(DataHandler handler, String name) throws MessagingException
    {
        BodyPart part = new MimeBodyPart();
        part.setDataHandler(handler);
        part.setDescription(name);

        DataSource source = handler.getDataSource();

        *// Only set the file name if the DataSource is a file*
        if (source instanceof FileDataSource)
        {
            part.setFileName(StringUtils.defaultString(handler.getName(), name));
        }
        return part;
    }
I think that it should use the DataSource name or the  attachment name when the attachment is not a File:
Note: the full code I use in my example is in the Configuration

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://www.mulesource.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email