You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "dion gillard (JIRA)" <ji...@apache.org> on 2007/02/01 07:18:05 UTC
[jira] Closed: (EMAIL-22) [email] New embed method for HtmlEmail
[ 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