commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dion gillard (JIRA)" <j...@apache.org>
Subject [jira] Closed: (EMAIL-22) [email] New embed method for HtmlEmail
Date Thu, 01 Feb 2007 06:18:05 GMT

     [ https://issues.apache.org/jira/browse/EMAIL-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

dion gillard closed EMAIL-22.
-----------------------------

    Resolution: Duplicate

Email-35 looks like a better patch as well.

> [email] New embed method for HtmlEmail
> --------------------------------------
>
>                 Key: EMAIL-22
>                 URL: https://issues.apache.org/jira/browse/EMAIL-22
>             Project: Commons Email
>          Issue Type: Bug
>         Environment: Operating System: other
> Platform: Other
>            Reporter: zarkon
>
> Hi!
> I've written a new "embed" method (simply but neccesary) for the HtmlEmail
> class:
>     public String embed(DataSource ds, String name) throws EmailException{
>     	
>          // verify that the DataSource is valid
>         try
>         {
>             if (ds == null || ds.getInputStream() == null)
>             {
>                 throw new EmailException("Invalid Datasource");
>             }
>         }
>         catch (IOException e)
>         {
>             throw new EmailException("Invalid Datasource");
>         }
>         MimeBodyPart mbp = new MimeBodyPart();
>         try
>         {
>             mbp.setDataHandler(new DataHandler(ds));
>             mbp.setFileName(name);
>             mbp.setDisposition("inline");
>             String cid = randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase();
>             mbp.addHeader("Content-ID", "<" + cid + ">");
>             this.inlineImages.add(mbp);
>             return cid;
>         }
>         catch (MessagingException me)
>         {
>             throw new EmailException(me);
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message