Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Email with HTML content is not working in production system!!!

naveen_inuganti2
Active Contributor
0 Kudos

We implemented program to send email with HTML content. Using BCS class for it. Below is the code... This is working fine in all the systems but not in our production system. In production, we are receiving emails without formatting i.e. with HTML tags as plain text document. Mail has details about content type and it says "text/html" is type but when we look at source there it is "text/plain". We have one pre-production system which is recent copy of our production system and this is working fine in pre-production system. Please let me know if you have any clue...

   try.

    obj_cl_bcs = cl_bcs=>create_persistent( ).

    lv_document = cl_document_bcs=>create_document(

                                           i_type = 'HTM'

                                           i_text = objcont

                                           i_length = l_doc_len

                                           i_subject = subject_dummy

                                           i_language = sy-langu

                                           i_importance = '1' ).

    call method obj_cl_bcs->set_document( lv_document ).

* Sender email Address

    lv_sender = cl_cam_address_bcs=>create_internet_address( v_smail ).

    obj_cl_bcs->set_sender( lv_sender ).

* Receiver email address

    lv_recipient = cl_cam_address_bcs=>create_internet_address(

                                       v_email ).

    call method obj_cl_bcs->add_recipient exporting i_recipient = lv_recipient

               i_express   = 'X'.

* Receiver email address

    lv_cc_mailid = cl_cam_address_bcs=>create_internet_address(

                                       v_smail ).

    call method obj_cl_bcs->add_recipient exporting i_recipient = lv_cc_mailid

               i_copy   = 'X'.

    call method obj_cl_bcs->set_status_attributes(

           i_requested_status = 'E'

           i_status_mail = 'E').

    call method obj_cl_bcs->set_message_subject exporting ip_subject = subject.

* Send email

    call method obj_cl_bcs->set_send_immediately

     exporting

      i_send_immediately = 'X'.

    call method obj_cl_bcs->send(

     exporting

       i_with_error_screen = 'X'

     receiving

       result              = l_request ).

    catch cx_document_bcs .

    catch cx_send_req_bcs.

    catch cx_address_bcs.

   endtry.

   commit work.

Thanks,

Naveen Inuganti.

1 ACCEPTED SOLUTION

naveen_inuganti2
Active Contributor
0 Kudos

We had issue with content of email subject. We were passing "ENTER" command into subject and this is causing above issue.

Closing this thread.

Thanks,

Naveen Inuganti

4 REPLIES 4

naveen_inuganti2
Active Contributor
0 Kudos

We had issue with content of email subject. We were passing "ENTER" command into subject and this is causing above issue.

Closing this thread.

Thanks,

Naveen Inuganti

0 Kudos

Naveen,

I need an help.

I have a HTML file output. I need to email HTML file from SAP ABAP program.

How to append internal table for storing binary contents (CONTENTS_HEX). Since already a output HTML file exist, I need a help in filing the internal table. Whether I should parse the HTML output to get tags.

Thank you.

With Regards,
Gandhi Subramani

0 Kudos

Subramani,

Yes you should convert that file into HTML document. As we know, it will have <html><body> and other tags in it. If you want to send that content as body of your email then you can use code in my question.

Look at OBJCONT table in my code, this is where you can fill your content. I think you can find sample code in SCN. Let me know if you need any other inputs around this.

Thanks,

Naveen Inuganti

0 Kudos

Hi Naveen,

Thank you. Please let me know whether there is any function module to parse the HTML tags so

I can append the internal table (contents for email). If no function module, I have to write code

to parse and fill internal table.

With Regards,

Gandhi Subramani