IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

display image in html template

  • 1.  display image in html template

    Posted Thu January 18, 2007 04:52 PM

    Hi,

    I am trying to send an email with HTML template as an attachment. This is working fine with text messages. Now Im trying to add images to the HTML and Iam not getting the images in the html template.

    Here is the approach I followed.

    template:
    /packages//templates/sample.html

    this html refers image1.jpg using

    I have placed the image in
    /packages//pub/images directory.

    I have addded .access file and mentioned * Anonymous to both pub and images directory.

    but still this is giving error.

    Is there anything else I need to do or am I missing anything? any expertise?

    Regards
    Sai Arun


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: display image in html template

    Posted Thu January 18, 2007 06:38 PM

    Your img tag is going to need to be an absolute and complete path for anything outside of IS to be able to retrieve the image. That means using a full URL including the hostname and port.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: display image in html template

    Posted Thu January 18, 2007 11:14 PM

    I am not sure I understand you correctly, so let me make my answer conditional to the presumption:

    Presumption
    You are generating this HTML which will be sent as an attachment in an email. The attached HTML is required to contain image(s).

    Treasure Hunt Clue
    Using the image tag to give path to the image file will not work, because when the recipient of the email will open the HTML, the image path wouldn’t be found. To achieve this, you will have to create mime object for image and populate the contents of this mime with data of the image. Then in your HTML you will have to give the id of this mime object as img src. Effectively, you are embedding the image.

    Alternatively, you can host the image at a location that is accessible to the recipient of the email without requiring a userid/password and then use the absolute path of the image in your html.

    I have used this approach in the past - can’t recall the exact steps right now… but this should give you a direction.

    ~Rohit


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: display image in html template

    Posted Fri January 19, 2007 06:03 AM

    Approach One
    If you want to send the html as an attachment, you’re gonna have use the full path as Rob said. Though you’re gonna have to bear in mind is that the resource (your server & the image on it) is accessible to the recipient of the mail. For example, if the image is logo.jpg in pub/images folder of IS package MyPackage, the following will work:

    However, the above approach will not work if your IS server is not accessible to the recipient of the email.

    Approach Two
    Alternatively you can send the entire email as an HTML and embed the image in the HTML. Use the MIME services to create a multipart/related mime data with first part containing the html and the next one containing the image data… use the Content-ID header tag to specify an id to the image data part and use this id as the img src in the HTML.

    HTH ~Rohit


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: display image in html template

    Posted Wed January 24, 2007 10:51 AM

    Another approach:
    Attach an image to the email (encode it base64, give it a name and remember to put in the right content type).
    In your HTML code use the Content ID to point to any attachment in your email:
    Imagine the image you are attaching is called B2B.jpg, you would have to use it like this:

    It works perfectly for me.
    Regs,

    Master F


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 6.  RE: display image in html template

    Posted Sat December 22, 2007 04:51 AM

    Dear Friend,

                      i have requirement to send email and to 
    

    display the image in the body of the html content. i don’t which service to get Content-ID. give the details information of sending email with image.
    Thanks.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 7.  RE: display image in html template

    Posted Sat December 22, 2007 11:29 PM

    There were three alternatives given already in this thread. You mentioned that one of them would not work for you for some reason. What about the other two. Can you explain why they would not work?

    Mark


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 8.  RE: display image in html template

    Posted Mon December 24, 2007 05:28 AM

    thanks for your reply

       please find the TESTFILE.zip. this file contains my progam with. i dont where i am mistaking.
    

    my Requirement:

             This program do the image as an attachment in email. but not display the image in attachment. can you explain the where to get CONTENT-ID or how to use it. 
    Thanks in advance.
    

    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 9.  RE: display image in html template

    Posted Thu March 04, 2010 08:07 AM

    Here is our solution and It works perfectly for us.

    1. getFile
    2. attach bytes to content of smtp attachment
    3. set file name to be remember
    4. set encoding to based64
    5. invoke smtp

    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 10.  RE: display image in html template

    Posted Wed May 16, 2012 06:00 AM

    hi masterf

    can you tell me how do u set the Content ID to attachment in mail?


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services