Send e-mail in HTML-format with attachment

Does function SO_OBJECT_SEND allow to send e-mail with attachment?
Does function SO_DOCUMENT_SEND_API1 allow to send e-mail in HTML format?

Hi SS
See if you can understand this sample program
PARAMETERS: po_email TYPE AD_SMTPADR LOWER CASE.
DATA: li_objcont TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objhead TYPE STANDARD TABLE OF solisti1,
li_content TYPE STANDARD TABLE OF solisti1,
lwa_objcont TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_objpack TYPE sopcklsti1,
lwa_objhead TYPE solisti1,
lwa_content TYPE solisti1,
lwa_doc TYPE sodocchgi1,
l_lines TYPE i.
REFRESH: li_objcont[], li_reclist[],
li_objpack[], li_objhead[],
li_content[].
CLEAR: lwa_objcont, lwa_reclist,
lwa_objpack, lwa_objhead,
lwa_content, lwa_doc.
MOVE '<body>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE '<p>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE 'This is a sample HTML content from test program' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE '</p>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE '</body>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
lwa_reclist-receiver = po_email.
lwa_reclist-rec_type = 'U'.
APPEND lwa_reclist TO li_reclist.
lwa_objhead = 'test.htm'.
APPEND lwa_objhead TO li_objhead.
lwa_content = 'Please find attached document for more details'.
APPEND lwa_content TO li_content.
CLEAR l_lines.
DESCRIBE TABLE li_content LINES l_lines.
READ TABLE li_content INTO lwa_content INDEX l_lines.
lwa_doc-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_content ).
lwa_doc-obj_langu = 'E'.
lwa_doc-obj_name = 'Test HTML file'.
lwa_doc-obj_descr = 'Test HTML file'.
CLEAR lwa_objpack-transf_bin.
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 0.
lwa_objpack-body_start = 1.
lwa_objpack-body_num = l_lines.
lwa_objpack-doc_type = 'RAW'.
APPEND lwa_objpack TO li_objpack.
CLEAR: lwa_objpack, l_lines.
DESCRIBE TABLE li_objcont LINES l_lines.
READ TABLE li_objcont INTO lwa_objcont INDEX l_lines.
lwa_objpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_objcont ).
lwa_objpack-transf_bin = 'X'.
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 0.
lwa_objpack-body_start = 1.
lwa_objpack-body_num = l_lines.
lwa_objpack-doc_type = 'HTM' .
lwa_objpack-obj_name = 'Test HTML file'.
lwa_objpack-obj_descr = 'Test HTML file'.
APPEND lwa_objpack TO li_objpack.
*Sending the mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc
put_in_outbox = 'X'
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objcont
contents_txt = li_content
receivers = li_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc NE 0.
WRITE:/ 'Document sending failed'.
ELSE.
WRITE:/ 'Document successfully sent'.
COMMIT WORK.
ENDIF.
This should give you all you need to know to send an HTML file.
Thanks buddy

Similar Messages

  • Send email in HTML format with attachment.

    I want to send out email in HTML fromat and attach a file to it. I know how to send HTML email but I cant attach a file to it.
    Can anybody help me with that?

    What kind of attachment?
    1) A file not related to the HTML
    or 2) a file used by the HTML (i.e. a GIF)?
    If 1) see here http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#SendingAttachments
    If 2) see here http://forum.java.sun.com/thread.jsp?forum=43&thread=242791
    (make sure you read all the thread as inline attachments are mentioned at the end)
    SH

  • How to send a mail in html format from a send mail workflow node ?

    Dear all,
    Do you know if it is possible to send an e-mail in HTML format (instead of RAW) from a "send mail" node in a workflow ?  ... if "yes", please, let me know.
    (I need to do that because I want to use the "href" tag to insert an hyperlink inside the e-mail)
    - I haven't found any parameter to specify the format of the e-mail.
    - Inside SCOT I tried to change the parameters for the SMTP node... without success.
    - I don't want to use a task calling the FM SO_OBJECT_SEND.
    Nicolas

    Hi Nicolas!
    Have you tried to set "Output Format" for "RAW Text" to HTM in SCOT.
    If HTM is missing in your dropdown-list, you could check out table SXCONVERT2. Copy the line with category T/format TXT, and change the format from TXT to HTM. The existing function
    SX_OBJECT_CONVERT__T.TXT does not need to be changed. Now you should be able to choose HTM in SCOT. You will probably need som HTML-tags in your text to make it look good.
    Hope this helps!
    Regards
    Geir

  • How to send a mail to the user with attachement

    Hi Experts,
    I have a requirement where user needs to get the automatic mail which has the updated information sheet as the attachement.
    Kindly give me a clue on this.
    if any body has model program for this...kidnly send it to [email protected]
    Thanks in Advance,
    Aiswarya

    HI
    good
    go throug this link
    http://help.sap.com/saphelp_nw04s/helpdata/en/38/71f865c2c9a94ab1dce95792187c16/content.htm
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    go through this report=>
    : Report  ZSAPTALK                                                   :
    : Author  SAPdev.co.uk                                               :
    : Description :                                                      :
    : Send mail message to SAP mail inbox.                               :
    :                     Please visit www.sapdev.co.uk for further info :
    REPORT ZSAPMAIL NO STANDARD PAGE HEADING.
    TABLES: DRAD,
            QINF,
            DRAW,
            SOUC,
            SOFD,
            DRAP.
    DATA: P_RETURN_CODE LIKE SY-SUBRC.
    data: d_username LIKE DRAP-PRNAM.
    mail declarations
    DATA : BEGIN OF NEW_OBJECT_ID.         " the newly created email object
            INCLUDE STRUCTURE SOODK.
    DATA : END OF NEW_OBJECT_ID.
    DATA : BEGIN OF FOLDER_ID.             " the folder id of the outbox
            INCLUDE STRUCTURE SOODK.
    DATA : END OF FOLDER_ID.
    DATA : BEGIN OF REC_TAB OCCURS 5.     " the table which will contain the
            INCLUDE STRUCTURE SOOS1.       " information on the destination
    DATA : END OF REC_TAB.
    DATA : BEGIN OF OBJECT_HD_CHANGE.      " the table which contains the
            INCLUDE STRUCTURE SOOD1.       " info for the object we will be
    DATA : END OF OBJECT_HD_CHANGE.        " creating
    DATA : OBJECT_TYPE LIKE SOOD-OBJTP.    " the type of object
    DATA : BEGIN OF OBJHEAD OCCURS 5.      " the header of the object
            INCLUDE STRUCTURE SOLI.
    DATA : END OF OBJHEAD.
    DATA : BEGIN OF OBJCONT OCCURS 0.      " the contents of the object
            INCLUDE STRUCTURE SOLI.        " i.e. the text etc
    DATA : END OF OBJCONT.
    DATA : BEGIN OF OBJPARA OCCURS 5.      " formatting options
            INCLUDE STRUCTURE SELC.
    DATA : END OF OBJPARA.
    DATA : BEGIN OF OBJPARB OCCURS 5.      " formatting options
            INCLUDE STRUCTURE SOOP1.
    DATA : END OF OBJPARB.
    DATA : BEGIN OF T_MAIL_TEXT OCCURS 0,  "Message table for messages to
            STRING(255),                   "user via mailbox
           END OF T_MAIL_TEXT.
    Parameter: p_uname like sy-uname.
    **START-OF-SELECTION
    START-OF-SELECTION.
        d_username = p_uname.
        PERFORM POPULATE_EMAIL_TEXT.
        PERFORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
        PERFORM CREATE_AND_SEND_MAIL_OBJECT.
          FORM POPULATE_EMAIL_TEXT                                      *
          Inserts text for email message                                *
    FORM POPULATE_EMAIL_TEXT.
      CLEAR T_MAIL_TEXT-STRING.            "puts a blank line in
      APPEND T_MAIL_TEXT.
      APPEND T_MAIL_TEXT.
    adds failed list  on to end of success list.
      T_MAIL_TEXT-STRING = 'Test email message line 1'.
      APPEND T_MAIL_TEXT.
      T_MAIL_TEXT-STRING = 'Test email message line 1'.
      APPEND T_MAIL_TEXT.
      CLEAR T_MAIL_TEXT-STRING.            "puts a blank line in
      APPEND T_MAIL_TEXT.
      T_MAIL_TEXT-STRING = 'Header1    Header2    Header3'.
      APPEND T_MAIL_TEXT.
      T_MAIL_TEXT-STRING = '----
      APPEND T_MAIL_TEXT.
    ENDFORM.
    *&      Form  SETUP_TRX_&_RTX_MAILBOXES
      Ensure that the mailboxes of the sender (INTMGR) are set up OK
    FORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
    get the user no of the sender in order to add the mail to the
    user name's outbox for future reference
      SELECT SINGLE * FROM SOUC
               WHERE SAPNAM = SY-UNAME.    "SAP name of a SAPoffice user
      IF SY-SUBRC NE 0.
        "Error finding the SAPoffice user info for the user
        MESSAGE E064(ZR53) WITH SY-UNAME.
        P_RETURN_CODE = 1.
        EXIT.
      ENDIF.
    *Get the outbox No for the sender from the user No where the folder
                                           " type is an outbox
      SELECT * FROM SOFD WHERE OWNTP = SOUC-USRTP   "Owner type from ID
                           AND OWNYR = SOUC-USRYR   "Owner year from the ID
                           AND OWNNO = SOUC-USRNO   "Owner number from the I
                           AND FOLRG = 'O'."Output box
      ENDSELECT.
      IF SY-SUBRC NE 0.
        " Error getting folder information for the user
        MESSAGE E065(ZR53) WITH SY-UNAME.
        P_RETURN_CODE = 1.
        EXIT.
      ENDIF.
    ENDFORM.                               " SETUP_TRX_&_RTX_MAILBOXES
    *&      Form  CREATE_AND_SEND_MAIL_OBJECT
    FORM CREATE_AND_SEND_MAIL_OBJECT.
      FOLDER_ID-OBJTP = SOFD-FOLTP.        " the folder type ( usually FOL )
      FOLDER_ID-OBJYR = SOFD-FOLYR.        " the folder year ( usually 22 )
      FOLDER_ID-OBJNO = SOFD-FOLNO.        " the folder no.
      OBJECT_TYPE     = 'RAW'.             " the type of object being added
    build up the object information for creating the object
      OBJECT_HD_CHANGE-OBJLA  = SY-LANGU.  " the language of the email
      OBJECT_HD_CHANGE-OBJNAM = 'PS to DM Interface'. " the object name
    mail subject 'Mass Linking of QA, pass/fail'
      MOVE TEXT-002 TO OBJECT_HD_CHANGE-OBJDES.
      OBJECT_HD_CHANGE-DLDAT = SY-DATUM.   " the date of the email
      OBJECT_HD_CHANGE-DLTIM = SY-UZEIT.   " the time of the email
      OBJECT_HD_CHANGE-OBJPRI = '1'.       " the priority ( highest )
      OBJECT_HD_CHANGE-OBJSNS = 'F'.       " the object sensitivity
    F is functional, C - company sensitive
    object_hd_change-skips  = ' '.       " Skip first screen
    object_hd_change-acnam  = 'SM35'.    " Batch imput transaction
    object_hd_change-vmtyp  = 'T'.       " Transaction type
    add the text lines into the contents of the email
      CLEAR OBJCONT.
      REFRESH OBJCONT.
    free objcont.      " added this to delete the mail contents records
      LOOP AT T_MAIL_TEXT.
        OBJCONT-LINE = T_MAIL_TEXT-STRING.
        APPEND OBJCONT.
      ENDLOOP.
      CLEAR OBJCONT.
    build up the table of receivers for the email
      REC_TAB-RCDAT = SY-DATUM.            " the date to send the email
      REC_TAB-RCTIM = SY-UZEIT.            " the time to send the email
    the SAP username of the person who will receive the email
      REC_TAB-RECNAM = D_USERNAME.
    the user type of the person who will send the email ( USR )
      REC_TAB-SNDTP = SOUC-USRTP.
    the user year of the person who will send the email ( 22 )
      REC_TAB-SNDYR = SOUC-USRYR.
    the user number of the person who will send the email
      REC_TAB-SNDNO = SOUC-USRNO.
    the sap username of the person who will send the email
      REC_TAB-SNDNAM = SY-UNAME.
    get the user info for the receiver of the document
      SELECT SINGLE * FROM SOUC WHERE SAPNAM = D_USERNAME.
      IF SY-SUBRC NE 0.
        WRITE : / TEXT-001, D_USERNAME.    "usnam.
        EXIT.
      ENDIF.
    the user number of the person who will receive the email ( USR )
      REC_TAB-RECNO = SOUC-USRNO.
    the user type of the person who will receive the email ( USR )
      REC_TAB-RECTP = SOUC-USRTP.
    the user year of the person who will receive the email ( USR )
      REC_TAB-RECYR = SOUC-USRYR.
    the priority of the email ( highest )
      REC_TAB-SNDPRI = '1'.
    check for delivery on the email
      REC_TAB-DELIVER = 'X'.
    send express so recipient knows there is a problem
      REC_TAB-SNDEX = 'X'.
    check for a return receipt
      REC_TAB-READ = 'X'.
    the sap username of the person receiving the email
      REC_TAB-ADR_NAME = D_USERNAME.       "usnam.
    add this receiver to the internal table
      APPEND REC_TAB.
      CLEAR REC_TAB.
    call the function to create the object in the outbox of the sender
      CALL FUNCTION 'SO_OBJECT_INSERT'
           EXPORTING
                FOLDER_ID                  = FOLDER_ID
                OBJECT_HD_CHANGE           = OBJECT_HD_CHANGE
                OBJECT_TYPE                = OBJECT_TYPE
                OWNER                      = SY-UNAME
           IMPORTING
                OBJECT_ID                  = NEW_OBJECT_ID
           TABLES
                OBJCONT                    = OBJCONT
                OBJHEAD                    = OBJHEAD
                OBJPARA                    = OBJPARA
                OBJPARB                    = OBJPARB
           EXCEPTIONS
                ACTIVE_USER_NOT_EXIST      = 1
                COMMUNICATION_FAILURE      = 2
                COMPONENT_NOT_AVAILABLE    = 3
                DL_NAME_EXIST              = 4
                FOLDER_NOT_EXIST           = 5
                FOLDER_NO_AUTHORIZATION    = 6
                OBJECT_TYPE_NOT_EXIST      = 7
                OPERATION_NO_AUTHORIZATION = 8
                OWNER_NOT_EXIST            = 9
                PARAMETER_ERROR            = 10
                SUBSTITUTE_NOT_ACTIVE      = 11
                SUBSTITUTE_NOT_DEFINED     = 12
                SYSTEM_FAILURE             = 13
                X_ERROR                    = 14
                OTHERS                     = 15.
      IF SY-SUBRC NE 0.
        MESSAGE A063(ZR53) WITH SY-SUBRC.
        EXIT.
      ENDIF.
    call the function to send the already created email to the receivers
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                FOLDER_ID                  = FOLDER_ID
                OBJECT_ID                  = NEW_OBJECT_ID
                OUTBOX_FLAG                = 'X'
                OWNER                      = SY-UNAME
           TABLES
                RECEIVERS                  = REC_TAB
           EXCEPTIONS
                ACTIVE_USER_NOT_EXIST      = 1
                COMMUNICATION_FAILURE      = 2
                COMPONENT_NOT_AVAILABLE    = 3
                FOLDER_NOT_EXIST           = 4
                FOLDER_NO_AUTHORIZATION    = 5
                FORWARDER_NOT_EXIST        = 6
                NOTE_NOT_EXIST             = 7
                OBJECT_NOT_EXIST           = 8
                OBJECT_NOT_SENT            = 9
                OBJECT_NO_AUTHORIZATION    = 10
                OBJECT_TYPE_NOT_EXIST      = 11
                OPERATION_NO_AUTHORIZATION = 12
                OWNER_NOT_EXIST            = 13
                PARAMETER_ERROR            = 14
                SUBSTITUTE_NOT_ACTIVE      = 15
                SUBSTITUTE_NOT_DEFINED     = 16
                SYSTEM_FAILURE             = 17
                TOO_MUCH_RECEIVERS         = 18
                USER_NOT_EXIST             = 19
                X_ERROR                    = 20
                OTHERS                     = 21.
      IF SY-SUBRC EQ 0.
        MESSAGE I035(ZR53) WITH NEW_OBJECT_ID D_USERNAME. "usnam.
      ELSE.
        MESSAGE I036(ZR53) WITH D_USERNAME."      sy-subrc.
      ENDIF.
    ENDFORM.                               " CREATE_AND_SEND_MAIL_OBJECT
    thanks
    mrutyun

  • Sending E-mail in HTML format

    Hello All,
    I have to send e-mail to a customer but the e-mail should be sent out in an HTML Format which would look good.. 
    I know the FM to send the e-mail but how to build the body in the HTML format because i have a big bunch of text.
    Is there any way to create a HTML template in SMW0 and read the same using any function modules to build the body like given below...
    Eg:
    Dear Customer
    Multiples lines of text....
    Your suggestions are highly appreciated.
    Regards,
    Krishnakumar

    Try this way
      submit yXXXXX0001 exporting list to memory " Write a report for HTML body and properly format
                                                                       " and submit the report to list to memory
               with p_docno = xdocno
               and return.
      call function 'LIST_FROM_MEMORY'
        tables
          listobject = report_list
        exceptions
          not_found  = 1
          others     = 2.
      call function 'WWW_HTML_FROM_LISTOBJECT'
        exporting
          template_name = 'WEBREPORTING_REPORT'
        tables
          html          = report_html
          listobject    = report_list.
    Here internal table report_html contains body for HTML mail in HTML tags

  • Urgent Help. How to send the email in HTML format in Version 4.6c

    Hi,
      Please help me how to send a mail in HTML format with logo and specified format. Is it possible to send the SAPscript or Smartform in HTML format to external mail address.  The logo and the format is very important in this e-mail.
      quick response will help me better.
    Regards,
    Naidu

    Here is a sample program which emails HTML in the body.  Of course you can put an HTML tag in there that would point to the logo on some server(internet).  Notice we are just putting the HTML code in the MAILTXT table,  This is how we do it at my company.
    report zrich_0002.
    data: maildata   like sodocchgi1.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
      perform build_text_message.
      perform build_receivers.
      perform send_mail_nodialog..
    *      Form  BUILD_TEXT_MESSAGE
    form build_text_message.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      mailtxt  = '<html>'.
      append mailtxt.
      mailtxt  = '<head>'.
      append mailtxt.
      mailtxt  = '<title>Untitled Document</title>'.
      append mailtxt.
      mailtxt  = '<meta http-equiv="Content-Type" content="text/html;'.
      append mailtxt.
      mailtxt  = 'charset=iso-8859-1">'.
      append mailtxt.
      mailtxt  = '</head>'.
      append mailtxt.
      mailtxt  = '<body>'.
      append mailtxt.
      mailtxt  = '<div align="center"><em><font' .
      append mailtxt.
      mailtxt  = 'color="#0000FF" size="+7" face="Arial,'.
      append mailtxt.
      mailtxt  = 'Helvetica, sans-serif">THIS'.
      append mailtxt.
      mailtxt  = '  IS A TEST </font></em><font' .
      append mailtxt.
      mailtxt  = 'color="#0000FF" size="+7" face="Arial,'.
      append mailtxt.
      mailtxt  = 'Helvetica, sans-serif"></font>'.
      append mailtxt.
      mailtxt  = '</div>'.
      append mailtxt.
      mailtxt  = '</body>'.
      append mailtxt.
      mailtxt  = '</html>'.
      append mailtxt.
    endform.
    *      Form  BUILD_RECEIVERS
    form build_receivers.
    *  mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
    endform.
    *      Form  SEND_MAIL_NODIALOG
    form send_mail_nodialog.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.
    Regards,
    Rich Heilman

  • Send email in html format with pdf attachment

    I am trying to send an email out of SAP using an abap program in the html format with a pdf attachment. I am using the function module -SO_DOCUMENT_SEND_API1. I noticed that when i specify the body type of the message as 'RAW' I get to see the pdf attachments however when i switch it to 'HTM' I loose the attachment in the email generated. Can anyone please help me in solving this problem. Thanks!

      ld_email                 = p_email. "All email IDs
      ld_mtitle                 = 'Bank Statement'.
      ld_format                = 'PDF'. "Attachment Format
      ld_attdescription      = 'Statement'.
      ld_attfilename          = p_filename. "Name of file
      ld_sender_address      = p_sender_address. "Sender mail address
      ld_sender_address_type = p_sender_addres_type. "INT - Internet
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle . "Description
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle. "Description
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'HTM'. " THis is for BODY of mail RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    * Populate zerror return code
      ld_error = sy-subrc.

  • How to send program output as  mail in HTML format

    Hi Friends,
    I have a BDc which runs in background and its been Stored in my system and displayed as HTML format.
    My requirement is now i want that Same HTML file which i am displaying to be sent as a mail in HTML format itself..Kindly help me on this
    Thanks in advance
    kishore

    Hi,
    Below sample program might give you idea on sending HTML attachment.
    TYPES: BEGIN OF t_sal_ord,
               vbeln TYPE vbeln_va,
               posnr TYPE posnr_va,
               auart TYPE auart,
               vkorg TYPE vkorg,
               matnr TYPE matnr,
             END OF t_sal_ord.
      DATA: i_sal_ord TYPE STANDARD TABLE OF t_sal_ord,
            i_header TYPE STANDARD TABLE OF w3head,
            i_fields TYPE STANDARD TABLE OF w3fields,
            i_html TYPE STANDARD TABLE OF w3html,
            wa_header TYPE w3head.
      DATA: i_fcat TYPE lvc_t_fcat,
            wa_fcat TYPE lvc_s_fcat.
      DATA: g_send_request TYPE REF TO cl_bcs,
            g_document TYPE REF TO cl_document_bcs,
            g_recipient TYPE REF TO cl_cam_address_bcs,
            g_cx_bcs TYPE REF TO cx_bcs,
            g_sent_to_all TYPE os_boolean.
      DATA: g_lines TYPE i,
            g_size TYPE so_obj_len.
      PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY,
                  p_mailad TYPE ad_smtpadr OBLIGATORY.
    START-OF-SELECTION.
      SELECT a~vbeln b~posnr a~auart a~vkorg b~matnr
        INTO TABLE i_sal_ord
        UP TO 20 ROWS
        FROM vbak AS a
        INNER JOIN vbap AS b
        ON a~vbeln  = b~vbeln
        WHERE a~vkorg = p_vkorg.
      wa_fcat-coltext = 'SalesOrd#'.
      APPEND wa_fcat TO i_fcat.
      wa_fcat-coltext = 'Item#'.
      APPEND wa_fcat TO i_fcat.
      wa_fcat-coltext = 'OrdType'.
      APPEND wa_fcat TO i_fcat.
      wa_fcat-coltext = 'Sales.Org'.
      APPEND wa_fcat TO i_fcat.
      wa_fcat-coltext = 'Material'.
      APPEND wa_fcat TO i_fcat.
      LOOP AT i_fcat INTO wa_fcat.
        wa_header-text = wa_fcat-coltext.
        CALL FUNCTION 'WWW_ITAB_TO_HTML_HEADERS'
          EXPORTING
            field_nr = sy-tabix
            text     = wa_header-text
            size     = '2'
            fgcolor  = 'BLACK'
            bgcolor  = 'VIOLET'
            font     = 'CALIBRI'
          TABLES
            header   = i_header.
        CALL FUNCTION 'WWW_ITAB_TO_HTML_LAYOUT'
          EXPORTING
            field_nr = sy-tabix
            size     = '2'
            fgcolor  = 'BLACK'
            bgcolor  = 'WHITE'
            font     = 'CALIBRI'
          TABLES
            fields   = i_fields.
      ENDLOOP.
      wa_header-text = 'Sales Order Details'.
      wa_header-size = '2'.
      wa_header-font = 'CALIBRI'.
      CALL FUNCTION 'WWW_ITAB_TO_HTML'
       EXPORTING
    *     TABLE_ATTRIBUTES       = 'BORDER=1'
         table_header           = wa_header
    *     ALL_FIELDS             = 'X'
        TABLES
          html                   = i_html
          fields                 = i_fields
          row_header             = i_header
          itable                 = i_sal_ord.
      TRY .
          g_send_request = cl_bcs=>create_persistent( ).
          g_document = cl_document_bcs=>create_document(
                        i_type  = 'RAW'
    *                i_text  = i_content[]  " Body for Mail
                        i_subject = 'Sales Order Details' ).
          DESCRIBE TABLE i_html LINES g_lines.
          g_size = g_lines * 2 * 255.
          CALL METHOD g_document->add_attachment
            EXPORTING
              i_attachment_type    = 'HTM'
              i_attachment_subject = 'Sales Order Details'
              i_attachment_size    = g_size
              i_att_content_text   = i_html[].
          g_send_request->set_document( g_document ).
    g_recipient = cl_cam_address_bcs=>create_internet_address( p_mailad ).
          g_send_request->add_recipient(
             EXPORTING
               i_recipient = g_recipient
               i_express = 'X' ).
          g_send_request->set_send_immediately( 'X' ).
          g_send_request->send(
              EXPORTING
                i_with_error_screen = 'X'
              RECEIVING
                result = g_sent_to_all ).
          COMMIT WORK.
        CATCH cx_bcs INTO g_cx_bcs.
          WRITE:/ g_cx_bcs->error_type.
      ENDTRY.
    Kind Regards
    Eswar

  • How to send the body of mail in html format using servlet

    Hi
    i developed an servlet using sun.net.smtp.SmtpClient package,my servlet receiving data from an form,i can able to send mail successfully,but my mail body part is in the text format,but i would like to send it as an html format,for ex <input type="text" size="25" name="Name"> as an input field with value received from the form instead of showing tags as i mentioned<input type="text" size="25" name="Name"> ,any help would be appreciated.
    Regards.

    See this program
    But here whats the problem is ,
    some maiservers doesnot support html code if u send this mail to yahoo account it will show html code as it is,
    hotmail account encodes the html and shows proper fonts and headings
    import java.io.*;
    import java.util.*;
    import java.net.*;
    import sun.net.smtp.SmtpClient;
    public class SendMail {
              public static void main(String args[]){
              int i = 0;
              //while (true) {
              SmtpClient mail;
              try{
                   i++;
                   String email = "[email protected]";
                   String from="[email protected]";
                   mail=new SmtpClient("bizpivot.com");
                   mail.from(from);
              mail.to(email);
                   PrintStream msg=mail.startMessage();
                   msg.println("To: " +email);
                   msg.println("Subject: Hai" i "!!!");
                   msg.println("<html><head><title>Untitled</title></head><body bgcolor='red' text='#00ffff'><font face='Courier New' size='+3'>Hai How are you Man!!!</font></body></html>");
                   mail.closeServer();
              System.out.println(i);
              catch(Exception e){e.printStackTrace();}

  • How to send mail in  HTML  format using SMTP

    I want to send mail in HTML format using SMTP.Can anybody please suggest how to do it.Can anybody send me the code.
    Thnx.

    If you don't know how to send a message using JavaMail see here : http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailSending
    To send a html format mail you need to set the content type like this (msg is a javax.mail.internet.MimeMessage) :
    String subject = "An Email 4 U";
    String message = "<HTML><BODY>Here is a link<br><a href='http://javasoft.com'>Java</a></BODY></HTML>";
    msg.setSubject(subject);
    msg.setContent(message, "text/html");p.s This isn't really an advanced topic

  • How to send a mail in pdf format file in sbwp??

    how to send a mail in pdf format file in sbwp?? and how to read the content of the mail?

    Refer the following link for Sample Program:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

  • My phone has been changed under warranty by the apple store in germany. ı need a change document to register the phone in my country again. ımeı numbers of old and new must be in the document.you can send an mail in pdf format as soon as possible please.

    my phone has been changed under warranty by the apple store in germany.
    ı need a change document to register the phone in my country again.
    ımeı numbers of old and new must be in the document.you can send an mail in pdf format
    as soon as possible please.
    your's respectfully.
    new phone serial no:DQ******TC0
    old phone serial no:DN*******T9Y
    Product:
    iPhone 4S
    Serial Number:
    DN*******T9Y
    Service Requested:
    December 3, 2012
    Status:
    Repair Complete
    <Edited by Host>

    No we cannot send it to you because we are users just like you and Apple does not monitor these forums.
    But you can find the IMEI numbers yourself. Read the ENTIRE article:
    http://support.apple.com/kb/HT4061

  • Sending a mail from Orale APEX with File Attachments

    Hi All,
    I want one solution, i need to send a mail from my application with HTMLDB_MAIL.SEND package and i need to know wheather we can send a mail with file attachments in APEX,if it is possible then how can i send,Can any body please help me with this.
    Thanks

    dil84 wrote:
    Hi All,
    I want one solution, i need to send a mail from my application with HTMLDB_MAIL.SEND package and i need to know wheather we can send a mail with file attachments in APEX,if it is possible then how can i send,Can any body please help me with this.
    ThanksEmail attachments arrived with Apex version 3.1.

  • Need to send my spool in HTML format as Email attachment

    Hi All,
        Can anyone let me know how to send a HTML attachment in a mail.
    I have a ALV Report, when i execute, my report should pick the ALV Report output from spool, and should send a mail with spool output as HTML attachment.
    Please explain me how i need to do the above.
    Regards
    Nanda

    Hi Nanda,
    You can use 2 reports for this.
    In one report just display the ALV..
    and in the second report submit this first report  to memory and get it html format and then send it as an email.
    Just check this code (instead of alv...this is a normal report that is sent as HTML attachment)
    *--Tables
    TABLES: VBRK.
                     TYPES DECLARATION                                   *
    TYPES: BEGIN OF TY_VBRK,
            KUNAG TYPE KUNAG," Payer Id
           END OF TY_VBRK,
    *-- customer details
           BEGIN OF TY_KNA1,
            KUNNR TYPE KUNNR," Customer Id
            NAME1 TYPE NAME1," Customer Name
            ADRNR TYPE ADRNR," Address No
           END OF TY_KNA1,
    *-- Mailing details
           BEGIN OF TY_ADDR,
            ADDRNUMBER TYPE AD_ADDRNUM, " Address No
            MAIL_ID TYPE AD_SMTPADR,    " Email Address
           END OF TY_ADDR,
    *-- Log details
           BEGIN OF TY_MSG,
            STR1 TYPE AD_SMTPADR, " Email Address
            STR2 TYPE KUNNR,      " Payer Id
            STR3 TYPE NAME1,      " Payer Name
            STR4 TYPE D,          " Date
            STR5 TYPE T,          " Time
           END OF TY_MSG.
                 I N T E R N A L  T A B L E S                            *
    DATA: RECEPIENTS TYPE TABLE OF AD_SMTPADR, "table for email id's
          LISTOBJECT TYPE TABLE OF ABAPLIST,   "table with displayed list
          HTML TYPE TABLE OF W3HTML,           "html container
          RETURN TYPE TABLE_OF_STRINGS,        "message table
          IT_VBRK TYPE TABLE OF TY_VBRK,       "Billing Details
          IT_KNA1 TYPE TABLE OF TY_KNA1,       "Customer Details
          IT_ADDR TYPE TABLE OF TY_ADDR,       "Mail id
          IT_MSG TYPE TABLE OF TY_MSG.         "Log Details
    *-- Structure Declarations
    DATA: WA_REC TYPE AD_SMTPADR,
          WA_KNA1 TYPE TY_KNA1,
          WA_ADDR TYPE TY_ADDR,
          WA_MSG TYPE TY_MSG.
          Declarations for Sending mail                                  *
    *-- To Create link and add recepients address
    DATA: SEND_REQUEST TYPE REF TO CL_BCS.
    *-- To Create HTML document
    DATA: DOCUMENT TYPE REF TO CL_DOCUMENT_BCS.
    *-- To Create Sender Id
    DATA: SENDER_ID TYPE REF TO IF_SENDER_BCS.
    *-- To Create recepient address
    DATA: RECIPIENT TYPE REF TO IF_RECIPIENT_BCS.
    *-- To Handle Exceptions
    DATA: BCS_EXCEPTION TYPE REF TO CX_BCS.
    *-- To check if the mail is sent to all recepients
    DATA: SENT_TO_ALL TYPE OS_BOOLEAN.
    DATA: CONLENGTHS TYPE SO_OBJ_LEN . "To calculate length of the HTML file
                  V A R I A B L E S                                      *
    DATA: REPORT TYPE PROGRAMM,    "Report name
          SENDER TYPE AD_SMTPADR,  "Sender Address
          SUBJECT TYPE SO_OBJ_DES. "Subject
    DATA: BCS_MESSAGE TYPE STRING ."String to store exceptions
    DATA: V_KUNAG TYPE KUNAG.      "Payer Id
    DATA: V_MAIL TYPE AD_SMTPADR,  "Mail Address
          V_DATE TYPE ZZBCDATE.    "To Validate Entered Date
                 S E L C T I O N - S C R E E N                           *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_ZZBCDA FOR VBRK-ZZBCDAT. "Billing Complete Date
    PARAMETERS:     P_MAILFT TYPE AD_SMTPADR,  "Mail id
                    P_MAILSC TYPE AD_SMTPADR.  "Mail id
    SELECTION-SCREEN END OF BLOCK B1.
                      At Selection Screen                                *
    AT SELECTION-SCREEN.
    *-- Validate the dates entered
      SELECT ZZBCDAT UP TO 1 ROWS
              FROM VBRK
              INTO V_DATE
              WHERE ZZBCDAT IN S_ZZBCDA.
      ENDSELECT.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Dates Not Found In The Given Range'(002).
      ENDIF.
                 S T A R T - O F - S E L E C T I O N                     *
      CONCATENATE SY-UNAME '@YAHOO.COM'(003) INTO SENDER.
    *-- Populating the Subject Line
      MOVE 'Invoice Due Date Details'(004) TO SUBJECT.
    *-- Selecting the Payer Details Based on Input Dates
      SELECT KUNAG
              FROM VBRK
              INTO TABLE IT_VBRK
                   WHERE ZZBCDAT IN S_ZZBCDA.
    *-- Selecting the Address Number from Customer Master
      SELECT KUNNR
             NAME1
             ADRNR
              FROM KNA1
              INTO TABLE IT_KNA1
                   FOR ALL ENTRIES IN IT_VBRK
                   WHERE KUNNR = IT_VBRK-KUNAG.
    *-- Selecting the Mail Id's
      SELECT ADDRNUMBER
             SMTP_ADDR
              FROM ADR6
              INTO TABLE IT_ADDR
                   FOR ALL ENTRIES IN IT_KNA1
                   WHERE ADDRNUMBER = IT_KNA1-ADRNR.
    *-- Getting all the selected mail Id's
      RECEPIENTS = IT_ADDR[].
      MOVE (your first report name) TO REPORT.
      IF NOT RECEPIENTS[] IS INITIAL .
        LOOP AT IT_KNA1 INTO WA_KNA1.
          AT NEW KUNNR.
            READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNA1-KUNNR
                                                              BINARY SEARCH.
            REFRESH RECEPIENTS.
    *-- Populating the Recepients Mail Id's for the Particular Kunnr
            LOOP AT IT_ADDR INTO WA_ADDR WHERE ADDRNUMBER = WA_KNA1-ADRNR.
              IF NOT WA_ADDR IS INITIAL.
                TRANSLATE WA_ADDR-MAIL_ID TO UPPER CASE.
                APPEND WA_ADDR-MAIL_ID TO RECEPIENTS.
              ENDIF.
            ENDLOOP.
    *-- Appending the mail id's from the input fields when not initial
            IF NOT P_MAILFT IS INITIAL.
              TRANSLATE P_MAILFT TO UPPER CASE.
              APPEND P_MAILFT TO RECEPIENTS.
            ENDIF.
            IF NOT P_MAILSC IS INITIAL.
              TRANSLATE P_MAILSC TO UPPER CASE.
              APPEND P_MAILSC TO RECEPIENTS.
            ENDIF.
    *-- Sending the Kunnr while Submitting the Report
            V_KUNAG = WA_KNA1-KUNNR.
            TRANSLATE REPORT TO UPPER CASE .
    *--Submitting the Report Exporting the List to Memory
            SUBMIT (REPORT) WITH S_ZZBCDA IN S_ZZBCDA
                            WITH P_KUNAG = V_KUNAG
                             EXPORTING LIST TO MEMORY AND RETURN.
            CLEAR: LISTOBJECT , HTML .
            REFRESH : LISTOBJECT, HTML .
    *-- Calling the Fn Module to get the list from the Memory
            CALL FUNCTION 'LIST_FROM_MEMORY'
              TABLES
                LISTOBJECT = LISTOBJECT.
    *-- Calling Fn Module to get the List in HTML Format
            CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
              EXPORTING
                REPORT_NAME = REPORT
              TABLES
                HTML        = HTML
                LISTOBJECT  = LISTOBJECT.
    *-- Getting the Size of the Html Document
            DATA: V_LINES TYPE I.
            DESCRIBE TABLE HTML LINES V_LINES.
            CLEAR CONLENGTHS .
            CONLENGTHS = V_LINES * 255.
            TRY.
                CLEAR SEND_REQUEST .
                SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
                CLEAR DOCUMENT .
    *-- Creating the Document
                DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                I_TYPE = 'HTM'
                I_TEXT = HTML
                I_LENGTH = CONLENGTHS
                I_SUBJECT = SUBJECT ).
    *-- add document to send request
                CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
                CLEAR SENDER_ID .
    *-- Creating the internet address for the sender id.
          SENDER_ID = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( SENDER ).
                CALL METHOD SEND_REQUEST->SET_SENDER
                  EXPORTING
                    I_SENDER = SENDER_ID.
                CLEAR WA_REC .
    *-- Creating the Recepients address
                LOOP AT RECEPIENTS INTO WA_REC .
                  CLEAR RECIPIENT .
                  RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
                  WA_REC ).
    add recipient with its respective attributes to send request
                  CALL METHOD SEND_REQUEST->ADD_RECIPIENT
                    EXPORTING
                      I_RECIPIENT = RECIPIENT
                      I_EXPRESS   = 'X'.
                ENDLOOP .
                CALL METHOD SEND_REQUEST->SET_STATUS_ATTRIBUTES
                  EXPORTING
                    I_REQUESTED_STATUS = 'E'
                    I_STATUS_MAIL      = 'E'.
                CALL METHOD SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
    *-- Sending the Document
                CALL METHOD SEND_REQUEST->SEND(
                EXPORTING
                I_WITH_ERROR_SCREEN = 'X'
                RECEIVING
                RESULT = SENT_TO_ALL ).
                IF SENT_TO_ALL = 'X'.
    *-- Getting the details to display the Job Log
                  LOOP AT RECEPIENTS INTO V_MAIL.
                    WA_MSG-STR1 = V_MAIL.
                    WA_MSG-STR2 = WA_KNA1-KUNNR.
                    WA_MSG-STR3 = WA_KNA1-NAME1.
                    WA_MSG-STR4 = SY-DATUM.
                    WA_MSG-STR5 = SY-UZEIT.
                    APPEND WA_MSG TO IT_MSG.
                  ENDLOOP.
                ELSE.
                  APPEND 'Mail not sent'(005)  TO RETURN.
                ENDIF.
                COMMIT WORK.
              CATCH CX_BCS INTO BCS_EXCEPTION.
                BCS_MESSAGE = BCS_EXCEPTION->GET_TEXT( ).
                APPEND BCS_MESSAGE TO RETURN .
                EXIT.
            ENDTRY.
          ENDAT.
        ENDLOOP.
      ELSE .
        APPEND 'Specify email address for sending'(006) TO RETURN .
      ENDIF .
                     E N D - O F - S E L E C T I O N                     *
    END-OF-SELECTION.
    *-- Displaying the Job Log
      FORMAT COLOR 1 INTENSIFIED ON.
      WRITE:/        SY-ULINE(121),
                (40) 'Mail Sent to'(007),
                     SY-VLINE,
                (12) 'Payer Id'(008),
                     SY-VLINE,
                (35) 'Payer Name'(009),
                     SY-VLINE,
                (10) 'Sent Date'(010),
                     SY-VLINE,
                (10) 'Sent Time'(011),
                     SY-VLINE,
                     SY-ULINE(121).
      LOOP AT IT_MSG INTO WA_MSG.
        FORMAT COLOR 2 INTENSIFIED ON.
        WRITE:/         SY-ULINE(121),
                   (40) WA_MSG-STR1,
                        SY-VLINE,
                   (12) WA_MSG-STR2,
                        SY-VLINE,
                   (35) WA_MSG-STR3,
                        SY-VLINE,
                   (10) WA_MSG-STR4  DD/MM/YYYY,
                        SY-VLINE,
                   (10) WA_MSG-STR5  USING EDIT MASK '__:__:__',
                        SY-VLINE,
                        SY-ULINE(121).
      ENDLOOP.

  • Send mail in HTML format

    Is it possible with ODISendMail to send mail not in simple text but in HTML?
    If no... how can I do that?

    If you are looking for capturing the error in the HTML format that can be done by using odioutfile and save the file as HTML and use the required command at the message tab to capture the error .
    in the Next step use - odisendmail attach the above html file as attached.

Maybe you are looking for

  • HT1423 Purchased 2x2GB Memory modules, and installed . No dock , no Menue bar??

    What to do??? Purchase from Apple On-Line store 2x 2GB memory module. at appears iMac does not regognice the new memory. Mac OS X asking for pass word, still running on Snow leopard.

  • Problem in reading the FROM_TIME from CRMD_SCHEDLIN

    HI , I have problem in reading the dates from the table CRMD_SCHEDLIN . what I have noticed is that if the date is stored  as 2004.11.14 23:00:00 then in the display of the sales order Tx-CRMD_BUS2000115 the date is shown as one plus the date stored

  • Problem to  Use C function in oracle

    Hi Friends, i m trying to use c funciton in oracle as per oralce documentation its working fine when i used the demo example but in demo example thr are only interger data type used i need to use the char data type from c and while calling that funct

  • Cant install itunes. error code 80070002.

    error code 80070002 comes up everytime i try to install. I have tried cleaning the data store and downloaded files, I tried a sfc/scannow, i tried to rename the files and I tried a system restore. It still wount download and windows will not update d

  • I don't believe if analytic functions do it for me or not

    Hey everyone, I'm looking for a way handling this report for my own job. a table having the following attributes exists. Create table Test ( Public_Date varchar2(10), City varchar2(10), count     number(3)) Query with the following output readily cou