Skip to Content
avatar image
Former Member

Send e-Mails with attached MIME-Objects from Repository

Hi everyone!

Does someone know a solution to send e-Mails with attached MIME-Objects from MIME-Repository?

At the moment I'm using the class CL_BCS to send mail with works fine. Now I just want to attach (or even better embed!) for example one or more icons from the MIME-Repository to this mail.

Thanks in advance!

Message was edited by: Marc Glässer

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 16, 2006 at 07:47 AM

    Welcome to SDN

    if you just want it as a image in the body of the mail, just send the image link as a html content in the body of the mail. (this has other problem, when openning the mail the system would require authentication into WAS system)

    to send it as a attachment

    1. read the mime

    DATA: binary_content TYPE solix_tab.

    data: o_mr_api type ref to if_mr_api.

    if o_mr_api is initial.

    o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).

    endif.

    call method o_mr_api->get

    exporting

    i_url = l_url

    importing

    e_is_folder = is_folder

    e_content = l_current

    e_loio = l_loio

    exceptions

    parameter_missing = 1

    error_occured = 2

    not_found = 3

    permission_failure = 4

    others = 5.

    l_current will hold the image in a XSTRING var

    convert the xstring to binary table

    REFRESH binary_content .

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

    EXPORTING

    buffer = l_current

    TABLES

    binary_tab = binary_content.

    CALL METHOD document->add_attachment

    EXPORTING

    i_attachment_type = 'GIF' " pass the right mime type

    i_attachment_subject = atta_sub

    i_att_content_hex = binary_content.

    Hope this helps.

    Regards

    Raja

    Add comment
    10|10000 characters needed characters exceeded