Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7843147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:28:59+00:00 2026-06-02T16:28:59+00:00

I’m trying to send an HTML e-mail with inline image attachments per the directions

  • 0

I’m trying to send an HTML e-mail with inline image attachments per the directions discussed here. In my e-mail XHTML file, I have the following lines to attach the image and then display it within the message:

<m:message xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:m="http://jboss.com/products/seam/mail">

    <m:from name="#{emailDetails.senderName}"
        address="#{emailDetails.senderAddress}" />
    <m:to name="#{emailDetails.recipientName}"
        address="#{emailDetails.recipientAddress}" />
    <m:subject>
        <h:outputText value="#{emailDetails.subject}" />
    </m:subject>

    <m:body>
        <p>THIS IS A TEST</p>
    <m:attachment contentType="image/png"
        fileName="dwx_logo.png" value="#{imageData}"
        status="logoImage" disposition="inline" /> 
    <img src="cid:#{logoImage.contentId}" alt="logo header"
        border="no" style="margin: 0px; padding: 0px; display: block;" />
    </m:body>
</m:message>

However, when I render the message with this code:

@In
private Renderer renderer = null;

...

    String senderName = "test";
    String senderAddress = ...
    String recipientName = "test";
    String recipientAddress = ...
    String subject = test";
    String messageTemplate = "/WEB-INF/emailTemplates/test.xhtml";

    InputStream inStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream("/logo_light.png");
    byte[] imageData = IOUtils.toByteArray(inStream);

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("imageData", imageData);

    EmailDetails details = new EmailDetails(senderName, senderAddress,
            recipientName, recipientAddress, subject);
    details.setMessageTemplate(messageTemplate);
    details.setEventParameters(params);

    Contexts.getEventContext().set("emailDetails", details);
    if (params != null) {
        Iterator<Map.Entry<String, Object>> it = params.entrySet()
                .iterator();
        while (it.hasNext()) {
            Map.Entry<String, Object> entry = it.next();
            Contexts.getEventContext()
                    .set(entry.getKey(), entry.getValue());
        }
    }

    renderer.render(messageTemplate);

I get the following exception…

Exception during request processing: Caused by javax.el.ELException
with message: “java.lang.NullPointerException”
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:280)
org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
org.jboss.seam.core.Expressions$2.invoke(Expressions.java:221)
org.jboss.seam.navigation.Pages.callAction(Pages.java:708)
org.jboss.seam.navigation.Pages.preRender(Pages.java:331)
org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:560)
org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:471)
org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:147)
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:117)
com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

Caused by java.lang.NullPointerException with message: “”
org.jboss.seam.mail.ui.UIBody.encodeChildren(UIBody.java:79)
org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
org.jboss.seam.mail.ui.UIMessage.encodeChildren(UIMessage.java:192)
org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
org.jboss.seam.ui.facelet.RendererRequest.renderFacelet(RendererRequest.java:140)
org.jboss.seam.ui.facelet.RendererRequest.run(RendererRequest.java:107)
org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:43)
com.dezinewerks.market.web.actions.test.TestAction.runTest(TestAction.java:986)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.seam.util.Reflections.invoke(Reflections.java:22)

I have also tried removing the “disposition=inline” line, at which point the code works as expected. It just doesn’t render the image inline, which defeats the purpose. Any idea why setting the disposition attribute value causes this exception? Is this a bug in Seam Mail? Or am I doing something wrong in my code?

Thanks in advance for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:29:00+00:00Added an answer on June 2, 2026 at 4:29 pm

    I have solved this myself. It turns out that any inline attachments need to be defined outside of the <m:body /> tag. Standard attachments work just fine within the message body, but inline attachments must be declared outside of it. Once I made this change, everything began to work as expected. This was not clear in the documentation, but was shown in the mail example within the Seam distribution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
i want to parse a xhtml file and display in UITableView. what is the
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.