Sending mail without attachment file

Hi Sapfans:
I would like to send mail without attachment file, just a notice,
needing multiple receiver, can change the mail title,
Which function shoud I use?
I just found out sending mail with attachment file there,
Thanks a lot!

Hi Alchie,
Please take a look at my example below. It sens e-mail to multiple recipients without attachments.
FUNCTION-POOL zts0001                    MESSAGE-ID sv.
INCLUDE lsvimdat                                . "general data decl.
INCLUDE lzts0001t00                             . "view rel. data dcl.
*/ Author: Aris Hidalgo
*/ Created on: September 7, 2006
*/ Purpose of program: This will send out e-mails to specified users in
*/ custom table ZSHIPTO_EMAIL whenever records have been deleted or
*/ modified via the maintenance view of ZTS0001. The changes will also
*/ be reflected in custom table ZTS_STPGEOLOC.
TABLES: zts_stpgeoloc,
        zshipto_email,
        kna1.
FIELD-SYMBOLS: <fs_old_total> TYPE ANY.
*       CLASS lcl_main DEFINITION ABSTRACT
CLASS lcl_main DEFINITION ABSTRACT.
  PUBLIC SECTION.
    TYPES: BEGIN OF t_zts0001_old,
            kunnr    TYPE zts0001-kunnr,
            cdseq    TYPE zts0001-cdseq,
            zaddress TYPE zts0001-zaddress,
            zcperson TYPE zts0001-zcperson,
            zcnumber TYPE zts0001-zcnumber,
           END OF t_zts0001_old.
    TYPES: BEGIN OF t_zts0001_new,
            kunnr    TYPE zts0001-kunnr,
            cdseq    TYPE zts0001-cdseq,
            zaddress TYPE zts0001-zaddress,
            zcperson TYPE zts0001-zcperson,
            zcnumber TYPE zts0001-zcnumber,
           END OF t_zts0001_new.
    TYPES: BEGIN OF t_zts_stpgeoloc,
            kunnr    TYPE zts_stpgeoloc-kunnr,
            cdseq    TYPE zts_stpgeoloc-cdseq,
            zaddress TYPE zts_stpgeoloc-zaddress,
            zcperson TYPE zts_stpgeoloc-zcperson,
            zcnumber TYPE zts_stpgeoloc-zcnumber,
           END OF t_zts_stpgeoloc.
    TYPES: BEGIN OF t_del_entries,
            kunnr    TYPE zts0001-kunnr,
            cdseq    TYPE zts0001-cdseq,
            zaddress TYPE zts0001-zaddress,
            zcperson TYPE zts0001-zcperson,
            zcnumber TYPE zts0001-zcnumber,
            name1    TYPE kna1-name1,
           END OF t_del_entries.
    TYPES: BEGIN OF t_modified_entries,
            kunnr       TYPE zts0001-kunnr,
            cdseq       TYPE zts0001-cdseq,
            old_address TYPE zts0001-zaddress,
            new_address TYPE zts0001-zaddress,
            old_person  TYPE zts0001-zcperson,
            new_person  TYPE zts0001-zcperson,
            old_number  TYPE zts0001-zcnumber,
            new_number  TYPE zts0001-zcnumber,
            name1       TYPE kna1-name1,
           END OF t_modified_entries.
    DATA: gt_zts0001_old      TYPE STANDARD TABLE OF t_zts0001_old,
          gt_zts0001_new      TYPE HASHED   TABLE OF t_zts0001_new
                                       WITH UNIQUE KEY kunnr cdseq,
          gt_zts_stpgeoloc    TYPE STANDARD TABLE OF t_zts_stpgeoloc,
          gt_del_entries      TYPE STANDARD TABLE OF t_del_entries,
          gt_modified_entries TYPE STANDARD TABLE OF t_modified_entries,
          gt_zshipto_email    TYPE STANDARD TABLE OF zshipto_email,
          t_maildata          TYPE sodocchgi1,
          gt_mailtxt          TYPE STANDARD TABLE OF solisti1,
          gt_mailrec          TYPE STANDARD TABLE OF somlreci1.
    DATA: v_old_total     TYPE i,
          v_new_total     TYPE i,
          v_flag(1)       TYPE c,
          v_counter(1)    TYPE c,
          v_contents(255) TYPE c.
ENDCLASS.
*       CLASS lcl_get_old_recs DEFINITION
CLASS lcl_get_old_recs DEFINITION INHERITING FROM lcl_main.
  PUBLIC SECTION.
    METHODS: export_old_recs.
ENDCLASS.
*       CLASS lcl_get_old_recs IMPLEMENTATION
CLASS lcl_get_old_recs IMPLEMENTATION.
  METHOD export_old_recs.
    SELECT kunnr cdseq zaddress zcperson zcnumber
    FROM zts0001
    INTO TABLE gt_zts0001_old.
    v_old_total = sy-dbcnt.
    ASSIGN v_old_total TO <fs_old_total>.
    EXPORT gt_zts0001_old = gt_zts0001_old TO MEMORY ID 'AVH'.
    CLEAR gt_zts0001_old. REFRESH gt_zts0001_old.
  ENDMETHOD.
ENDCLASS.
*       CLASS lcl_old_and_new DEFINITION
CLASS lcl_old_and_new DEFINITION INHERITING FROM lcl_main.
  PUBLIC SECTION.
    METHODS: compare_old_and_new.
ENDCLASS.
*       CLASS lcl_old_and_new IMPLEMENTATION
CLASS lcl_old_and_new IMPLEMENTATION.
  METHOD compare_old_and_new.
    DATA: wa_del_entries    LIKE LINE OF gt_del_entries.
    FIELD-SYMBOLS: <fs_old> LIKE LINE OF gt_zts0001_old,
                   <fs_new> LIKE LINE OF gt_zts0001_new.
    SELECT kunnr cdseq zaddress zcperson zcnumber
    FROM zts0001
    INTO TABLE gt_zts0001_new.
    v_new_total = sy-dbcnt.
    IF v_new_total <> <fs_old_total>.
      IMPORT gt_zts0001_old = gt_zts0001_old FROM MEMORY ID 'AVH'.
      LOOP AT gt_zts0001_old ASSIGNING <fs_old>.
        READ TABLE gt_zts0001_new WITH TABLE KEY kunnr = <fs_old>-kunnr
                                                 cdseq = <fs_old>-cdseq
                                                 ASSIGNING <fs_new>.
        IF sy-subrc <> 0.
          MOVE-CORRESPONDING <fs_old> TO wa_del_entries.
          APPEND wa_del_entries TO gt_del_entries.
          CLEAR wa_del_entries.
          DELETE FROM zts_stpgeoloc
          WHERE kunnr = <fs_old>-kunnr
            AND cdseq = <fs_old>-cdseq.
        ENDIF.
      ENDLOOP.
      IF NOT gt_del_entries[] IS INITIAL.
        EXPORT gt_del_entries = gt_del_entries TO MEMORY ID 'DEL'.
      ENDIF.
      REFRESH gt_zts0001_old.
    ENDIF.
  ENDMETHOD.
ENDCLASS.
*       CLASS lcl_check_changes DEFINITION
CLASS lcl_check_changes DEFINITION INHERITING FROM lcl_main.
  PUBLIC SECTION.
    METHODS: check_for_changes.
ENDCLASS.
*       CLASS lcl_check_changes IMPLEMENTATION
CLASS lcl_check_changes IMPLEMENTATION.
  METHOD check_for_changes.
    TYPES: BEGIN OF t_zts_stpgeoloc,
            mandt    TYPE zts_stpgeoloc-mandt,
            kunnr    TYPE zts_stpgeoloc-kunnr,
            cdseq    TYPE zts_stpgeoloc-cdseq,
            zcgeoloc TYPE zts_stpgeoloc-zcgeoloc,
            zaddress TYPE zts_stpgeoloc-zaddress,
            zcperson TYPE zts_stpgeoloc-zcperson,
            zcnumber TYPE zts_stpgeoloc-zcnumber,
           END OF t_zts_stpgeoloc.
    DATA: wa_modified_entries LIKE LINE OF gt_modified_entries,
          lt_zts_stpgeoloc    TYPE HASHED TABLE OF t_zts_stpgeoloc
                                   WITH UNIQUE KEY kunnr cdseq,
          wa_zts_stpgeoloc    LIKE LINE OF lt_zts_stpgeoloc.
    FIELD-SYMBOLS: <fs_zts0001_old> LIKE LINE OF gt_zts0001_old,
                   <fs_zts0001_new> LIKE LINE OF gt_zts0001_new.
    IMPORT gt_zts0001_old = gt_zts0001_old FROM MEMORY ID 'AVH'.
    SELECT kunnr cdseq zcgeoloc zaddress zcperson zcnumber
    FROM zts_stpgeoloc
    INTO CORRESPONDING FIELDS OF TABLE lt_zts_stpgeoloc.
    SELECT kunnr cdseq zaddress zcperson zcnumber
    FROM zts0001
    INTO TABLE gt_zts0001_new.
    LOOP AT gt_zts0001_old ASSIGNING <fs_zts0001_old>.
      READ TABLE gt_zts0001_new WITH TABLE KEY
                                     kunnr = <fs_zts0001_old>-kunnr
                                     cdseq = <fs_zts0001_old>-cdseq
                                     ASSIGNING <fs_zts0001_new>.
      IF sy-subrc = 0.
        READ TABLE lt_zts_stpgeoloc WITH TABLE KEY
                                        kunnr = <fs_zts0001_new>-kunnr
                                        cdseq = <fs_zts0001_new>-cdseq
                                        INTO wa_zts_stpgeoloc.
        IF sy-subrc = 0.
          wa_zts_stpgeoloc-mandt    = sy-mandt.
          wa_zts_stpgeoloc-kunnr    = <fs_zts0001_new>-kunnr.
          wa_zts_stpgeoloc-cdseq    = <fs_zts0001_new>-cdseq.
          wa_zts_stpgeoloc-zcgeoloc = space.
          wa_zts_stpgeoloc-zaddress = <fs_zts0001_new>-zaddress.
          wa_zts_stpgeoloc-zcperson = <fs_zts0001_new>-zcperson.
          wa_zts_stpgeoloc-zcnumber = <fs_zts0001_new>-zcnumber.
          MODIFY zts_stpgeoloc FROM wa_zts_stpgeoloc.
          COMMIT WORK AND WAIT.
        ENDIF.
*       address
        IF <fs_zts0001_old>-zaddress <> <fs_zts0001_new>-zaddress.
          MOVE: <fs_zts0001_new>-kunnr  TO wa_modified_entries-kunnr,
                <fs_zts0001_new>-cdseq  TO wa_modified_entries-cdseq,
          <fs_zts0001_old>-zaddress TO wa_modified_entries-old_address,
          <fs_zts0001_new>-zaddress TO wa_modified_entries-new_address.
          v_flag = 1.
        ENDIF.
*       person
        IF <fs_zts0001_old>-zcperson <> <fs_zts0001_new>-zcperson.
          MOVE: <fs_zts0001_new>-kunnr  TO wa_modified_entries-kunnr,
                <fs_zts0001_new>-cdseq  TO wa_modified_entries-cdseq,
          <fs_zts0001_old>-zcperson TO wa_modified_entries-old_person,
          <fs_zts0001_new>-zcperson TO wa_modified_entries-new_person.
          v_flag = 1.
        ENDIF.
*       number
        IF <fs_zts0001_old>-zcnumber <> <fs_zts0001_new>-zcnumber.
          MOVE: <fs_zts0001_new>-kunnr  TO wa_modified_entries-kunnr,
                <fs_zts0001_new>-cdseq  TO wa_modified_entries-cdseq,
          <fs_zts0001_old>-zcnumber TO wa_modified_entries-old_number,
          <fs_zts0001_new>-zcnumber TO wa_modified_entries-new_number.
          v_flag = 1.
        ENDIF.
      ENDIF.
      IF v_flag = 1.
        APPEND wa_modified_entries TO gt_modified_entries.
        CLEAR wa_modified_entries.
      ENDIF.
*     update ZTS_STPGEOLOC based from the modified records in ZTS0001
      IF v_flag = 1.
        CLEAR v_flag.
        UPDATE zts_stpgeoloc SET zaddress  = <fs_zts0001_new>-zaddress
                                  zcperson = <fs_zts0001_new>-zcperson
                                  zcnumber = <fs_zts0001_new>-zcnumber
                               WHERE kunnr = <fs_zts0001_new>-kunnr
                                 AND cdseq = <fs_zts0001_new>-cdseq.
      ENDIF.
    ENDLOOP.
    IF NOT gt_modified_entries[] IS INITIAL.
    EXPORT gt_modified_entries = gt_modified_entries TO MEMORY ID 'MOD'
    ENDIF.
  ENDMETHOD.
ENDCLASS.
*       CLASS lcl_messages DEFINITION
CLASS lcl_messages DEFINITION INHERITING FROM lcl_main.
  PUBLIC SECTION.
    METHODS: create_message.
ENDCLASS.
*       CLASS lcl_messages IMPLEMENTATION
CLASS lcl_messages IMPLEMENTATION.
  METHOD create_message.
    FIELD-SYMBOLS: <fs_email> LIKE LINE OF gt_zshipto_email,
                   <fs_del>   LIKE LINE OF gt_del_entries,
                   <fs_mod>   LIKE LINE OF gt_modified_entries.
    DATA: wa_mailtxt LIKE LINE OF gt_mailtxt,
          wa_mailrec LIKE LINE OF gt_mailrec.
    IMPORT gt_modified_entries = gt_modified_entries
                                 FROM MEMORY ID 'MOD'.
    IMPORT gt_del_entries = gt_del_entries FROM MEMORY ID 'DEL'.
    SELECT * FROM zshipto_email INTO TABLE gt_zshipto_email
     WHERE zevent = '2'.
    IF sy-dbcnt > 0.
*/    routine for records that were deleted
      IF NOT gt_del_entries[] IS INITIAL.
        t_maildata-obj_name  = 'Record Deleted in table ZTS0001'.
        t_maildata-obj_descr = 'Record Deleted in table ZTS0001'.
        t_maildata-obj_langu = sy-langu.
        CLEAR: v_flag, v_counter.
        LOOP AT gt_zshipto_email ASSIGNING <fs_email>.
          LOOP AT gt_del_entries ASSIGNING <fs_del>.
*           get name of dealer
            SELECT SINGLE name1 FROM kna1
            INTO <fs_del>-name1
            WHERE kunnr = <fs_del>-kunnr.
            IF v_counter IS INITIAL.
             CONCATENATE: 'FYI: The ff record/s were deleted in tables'
                           'ZTS0001 and ZTS_STPGEOLOC by user' sy-uname
                                                      INTO v_contents
                                                     SEPARATED BY space.
              wa_mailtxt-line =  v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
            ENDIF.
            APPEND wa_mailtxt TO gt_mailtxt. "Extra space for message
            CONCATENATE: 'Dealer :' <fs_del>-kunnr '-'
                         <fs_del>-name1
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
            CONCATENATE: 'Ship-To:' <fs_del>-cdseq
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
            CONCATENATE: 'Address:' <fs_del>-zaddress
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
            CONCATENATE: 'Contact person:' <fs_del>-zcperson
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
            CONCATENATE: 'Contact number:' <fs_del>-zcnumber
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
            v_counter = 1.
          ENDLOOP.
          wa_mailrec-receiver = <fs_email>-zemail.
          wa_mailrec-rec_type  = 'U'.
          APPEND wa_mailrec TO gt_mailrec.
          CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
               EXPORTING
                    document_data              = t_maildata
                    document_type              = 'RAW'
                    put_in_outbox              = 'X'
*                  commit_work                = 'X'
               TABLES
*                  object_header              = mailtxt
                    object_content             = gt_mailtxt
                    receivers                  = gt_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.
          CLEAR:    wa_mailtxt, wa_mailrec.
          REFRESH:  gt_mailtxt, gt_mailrec.
        ENDLOOP.
      ENDIF.
      CLEAR wa_mailtxt.
      REFRESH gt_mailtxt.
*/    routine for records that were modified
      IF NOT gt_modified_entries[] IS INITIAL.
        CLEAR t_maildata.
        t_maildata-obj_name  = 'Record changed in table ZTS0001'.
        t_maildata-obj_descr = 'Record changed in table ZTS0001'.
        t_maildata-obj_langu = sy-langu.
        CLEAR v_counter.
        LOOP AT gt_zshipto_email ASSIGNING <fs_email>.
          CONCATENATE: 'FYI: The ff records were changed in tables'
                       'ZTS0001 and ZTS_STPGEOLOC by user' sy-uname
                       INTO v_contents
                       SEPARATED BY space.
          wa_mailtxt-line =  v_contents.
          APPEND wa_mailtxt TO gt_mailtxt.
          CLEAR: wa_mailtxt, v_contents.
          LOOP AT gt_modified_entries ASSIGNING <fs_mod>.
*          get name of dealer
            SELECT SINGLE name1 FROM kna1
            INTO <fs_mod>-name1
            WHERE kunnr = <fs_mod>-kunnr.
            APPEND wa_mailtxt TO gt_mailtxt.
            CONCATENATE: 'Dealer :' <fs_mod>-kunnr '-'
                         <fs_mod>-name1
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
            CONCATENATE: 'Ship-To:' <fs_mod>-cdseq
                         INTO v_contents
                         SEPARATED BY space.
            wa_mailtxt-line = v_contents.
            APPEND wa_mailtxt TO gt_mailtxt.
            CLEAR: wa_mailtxt, v_contents.
*           address
            IF NOT <fs_mod>-old_address IS INITIAL AND
               NOT <fs_mod>-new_address IS INITIAL.
              CONCATENATE: 'Address from:' <fs_mod>-old_address
                           INTO v_contents
                           SEPARATED BY space.
              wa_mailtxt-line = v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
              CONCATENATE: 'Address to  :' <fs_mod>-new_address
                           INTO v_contents
                           SEPARATED BY space.
              wa_mailtxt-line = v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
            ENDIF.
*           person
            IF NOT <fs_mod>-old_person IS INITIAL AND
                   NOT <fs_mod>-new_person IS INITIAL.
              CONCATENATE: 'Contact person from:'
                           <fs_mod>-old_person
                           INTO v_contents
                           SEPARATED BY space.
              wa_mailtxt-line = v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
              CONCATENATE: 'Contact person to  :'
                           <fs_mod>-new_person
                           INTO v_contents
                           SEPARATED BY space.
              wa_mailtxt-line = v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
            ENDIF.
*           number
            IF NOT <fs_mod>-old_number IS INITIAL AND
                   NOT <fs_mod>-new_number IS INITIAL.
              CONCATENATE: 'Contact number from:'
                           <fs_mod>-old_number
                           INTO v_contents
                           SEPARATED BY space.
              wa_mailtxt-line = v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
              CONCATENATE: 'Contact number to  :'
                           <fs_mod>-new_number
                           INTO v_contents
                           SEPARATED BY space.
              wa_mailtxt-line = v_contents.
              APPEND wa_mailtxt TO gt_mailtxt.
              CLEAR: wa_mailtxt, v_contents.
            ENDIF.
          ENDLOOP.
          wa_mailrec-receiver = <fs_email>-zemail.
          wa_mailrec-rec_type  = 'U'.
          APPEND wa_mailrec TO gt_mailrec.
          CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
               EXPORTING
                    document_data              = t_maildata
                    document_type              = 'RAW'
                    put_in_outbox              = 'X'
*                  commit_work                = 'X'
               TABLES
*                  object_header              = mailtxt
                    object_content             = gt_mailtxt
                    receivers                  = gt_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.
          CLEAR:    wa_mailtxt, wa_mailrec.
          REFRESH:  gt_mailtxt, gt_mailrec.
        ENDLOOP.
      ENDIF.
    ENDIF.
    FREE MEMORY ID 'AVH'.
    FREE MEMORY ID 'DEL'.
    FREE MEMORY ID 'MOD'.
  ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
*       FORM get_orig_contents_of_zts0001                             *
*/ before saving the data in the database
FORM get_orig_contents_of_zts0001.
  DATA: get_old_recs TYPE REF TO lcl_get_old_recs.
  CREATE OBJECT get_old_recs.
  CALL METHOD get_old_recs->export_old_recs.
ENDFORM.
*       FORM get_rev_contents_of_zts0001                              *
*/ after saving the data in the database
FORM get_rev_contents_of_zts0001.
  DATA: old_and_new   TYPE REF TO lcl_old_and_new,
        check_changes TYPE REF TO lcl_check_changes,
        messages      TYPE REF TO lcl_messages.
  CREATE OBJECT: old_and_new, check_changes, messages.
  CALL METHOD old_and_new->compare_old_and_new.
  CALL METHOD check_changes->check_for_changes.
  CALL METHOD messages->create_message.
ENDFORM.
*       FORM move_latest_date_and_user                                *
FORM move_latest_date_and_user.
  zts0001-zcreated_by   = sy-uname.
  zts0001-zchanged_date = sy-datum.
ENDFORM.
Hope it helps...
P.S. Please award points if it helps...

Similar Messages

  • Send mail with attached file without using Repository

    Hello,
    I want to know if have a way to Send mail with attached file without using Repository.
    Regards
    Elad

    Elad,
    Check this article where a image has been picked by the file adapter and sent as an attachment to the mail adapter.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c6d38c5816">Sending an Image File Through XI in a File-to-Mail Scenario</a>
    For how to proceed without integration repository content look into this blog,
    <a href="/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository">How to send any data (even binary) through XI, without using the Integration Repository</a>
    Combining these 2 you have the solution.
    Regards
    Bhavesh

  • Convert Screen(spool) to PDF file sending mail with attach file

    Hi :
    I'd like convert spool list to pdf and sending file...
    so, I read thread about spool convert to PDF before,
    and know how to convert Spool to PDF file and send mail with attach file.
    but I have a problem.
    my solution as:
    step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
    step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
    then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
    I want to showing word is wider that 255.
    and then I find a manual method as:
    After program finished.
    Function Menu -> system -> List -> Send
    use Prog: "Create Document and Send"
    I use this prog sending mail and attached file ,
    PDF file do <b>NOT</b> have 255 word limit !
    finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
    which Function I have to use?...
    Please help me, Thanks!

    Hi,
    Check this sample code of sending spool as attachment to an email address..
    Parameters.
    PARAMETERS: p_email(50) LOWER CASE.
    PARAMETERS: p_spool LIKE tsp01-rqident.
    Data declarations.
    DATA: plist         LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: document_data LIKE sodocchgi1.
    DATA: so_ali        LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA: real_type     LIKE soodk-objtp.
    DATA: sp_lang       LIKE tst01-dlang.
    DATA: line_size     TYPE i VALUE 255.
    DATA: v_name        LIKE soextreci1-receiver.
    DATA rec_tab        LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    Get the spool data.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
         EXPORTING
              rqident              = p_spool
              first_line           = 1
              last_line            = 0
              desired_type         = '   '
         IMPORTING
              real_type            = real_type
              sp_lang              = sp_lang
         TABLES
              buffer               = so_ali
         EXCEPTIONS
              no_such_job          = 1
              job_contains_no_data = 2
              selection_empty      = 3
              no_permission        = 4
              can_not_access       = 5
              read_error           = 6
              type_no_match        = 7
              OTHERS               = 8.
    IF sy-subrc <> 0.
      MESSAGE s208(00) WITH 'Error'.
      LEAVE LIST-PROCESSING.
    ENDIF.
    Prepare the data.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 0.
    plist-body_num = 0.
    plist-doc_type = 'RAW'.
    plist-obj_descr = 'Test ALV'.
    APPEND plist.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 1.
    DESCRIBE TABLE so_ali LINES plist-body_num.
    plist-doc_type = real_type.
    Get the size.
    READ TABLE so_ali INDEX plist-body_num.
    plist-doc_size = ( plist-body_num - 1 ) * line_size
                     + STRLEN( so_ali ).
    APPEND plist.
    Move the receiver address.
    MOVE: p_email  TO rec_tab-receiver,
          'U'      TO rec_tab-rec_type.
    APPEND rec_tab.
    IF NOT sp_lang IS INITIAL.
      document_data-obj_langu = sp_lang.
    ELSE.
      document_data-obj_langu = sy-langu.
    ENDIF.
    v_name = sy-uname.
    Send the email.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
         EXPORTING
              document_data              = document_data
              sender_address             = v_name
              sender_address_type        = 'B'
         TABLES
              packing_list               = plist
              contents_bin               = so_ali
              receivers                  = rec_tab
         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 e208(00) WITH 'Error'.
    ENDIF.
    COMMIT WORK.
    Send the email immediately.
    SUBMIT rsconn01
    WITH mode = 'INT'
    AND RETURN.
    Thanks,
    Naren

  • Sending mail with attachment file through plsql

    Hi,
    Now i send the mail using utl_smtp and utl_tcp.
    How can i send a mail with a attachment file. That file is in the local directory. Can any one know just send me to the following mail id [email protected]
    Regards
    Suresh

    Hi,
    Now i send the mail using utl_smtp and utl_tcp.
    How can i send a mail with a attachment file. That file is in the local directory. Can any one know just send me to the following mail id [email protected].
    Regards
    Suresh

  • Send mail witch attach files from forms server 6i

    How to attach file from my logical drive , and sending mail via forms web 6i ?

    Hi jean,
    there is a lot of complication involved with trying to attach files using the java web server, the best thing i have done was i have added a microsoft windows email component on to my form and invoked its methods and properties, for eg. for attaching a file u have something called as microsoft windows common controls which opens the file open dialog box. Remember , trying to build email and messeging kind of applications with oracle tools is a bit complicated as of now because windows 2000 server has additional security features equivalent to standard firewall and the java interface of oracle looks for certifications for each and every cgi request.
    Rajendra - [email protected]

  • Send DOCMAS without attached files (Originals)

    I need to send DOCMAS header information from one system to another using ALE.  However, I have no need for the originals on the receiving system and they are causing me the error: Error while checking in and storing problem.
    Is there a flag that can be set telling ALE to ignore the attached files?
    I can see in the documentation for the E1DRAWM segment of the DOCMAS IDOC there are two fields:
    internal data type : CHAR
    Internal length : 000002 characters
    Position in segment : 037, Offset : 0598. external length : 000002
    ORIG1_DSTRB : Transport originals with ALE
    internal data type : CHAR
    Internal length : 000001 characters
    Position in segment : 038, Offset : 0600. external length : 000001
    ORIG2_DSTRB : Transport originals with ALE
    However, I cannot find any documentation on possible values for these fields.  Does anyone know?
    I see from this forum post, a similar person resolved this problem in BD79.  What Flag is being referred to here?
    [ALE/ IDoc: Error while checking in and storing|ALE/ IDoc: Error while checking in and storing]
    Thank you for your help.
    Scott

    ....maybe you can try to simulate message type DOCMAS from transaction WE19 before you run the ALE program in transaction BDA5

  • Using FM "SO_DOCUMENT_SEND_API1"  to send mail without attachment

    Hi,
    What are the parameters to be passed and their values
    to send a mail using SO_DOCUMENT_SEND_API1
    EXPORT PARAMETERS :
           document_data              = ?
          sender_address             = sy-userid
          sender_address_type        = 'INT'
          commit_work                = 'X'
        TABLES :
          packing_list               =  ?
          contents_bin               =  ?
    The content of the mail is not being displayed in the mail.
    Thanks in advance.
    Regards,Harika

    Hi Harika,
    Check below piece of code.
    *&      Form  mail_body
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM mail_body.
      DATA:  l_l1 TYPE i.
      CONSTANTS: lc_0 VALUE '0',
                 lc_1 VALUE '1',
                 lc_raw(3) TYPE c VALUE 'RAW'.
      REFRESH: i_objtxt[],
               i_objpack[].
      CLEAR: wa_objtxt.
      SORT i_fail BY type.
    * MAIL BODY
    * Customer Number
      CONCATENATE text-t18
                  w_kunnr
                  INTO wa_objtxt
                  SEPARATED BY space.
      APPEND wa_objtxt TO i_objtxt.
      CLEAR wa_objtxt.                        "blank line
      APPEND wa_objtxt TO i_objtxt.
    *  Complete Payment Doc Nos
      READ TABLE i_fail WITH KEY type = c_comp
                        TRANSPORTING NO FIELDS
                        BINARY SEARCH.
      IF sy-subrc EQ 0.
        wa_objtxt = text-t16.
        APPEND wa_objtxt TO i_objtxt.
        CLEAR: wa_fail, wa_objtxt.
        APPEND wa_objtxt TO i_objtxt.
        MOVE: text-t23   TO wa_objtxt,
              text-t24   TO wa_objtxt+17(5),
              text-t25   TO wa_objtxt+22(6),
              text-t26   TO wa_objtxt+40(18).
        APPEND wa_objtxt TO i_objtxt.
        CLEAR wa_objtxt.
        LOOP AT i_fail INTO wa_fail WHERE type EQ c_comp.
          DIVIDE wa_fail-disper BY 100.
          MOVE: wa_fail-belnr   TO wa_objtxt,
                wa_fail-buzei   TO wa_objtxt+17(5),
                wa_fail-wrbtr   TO wa_objtxt+22(16),
                wa_fail-disper  TO wa_objtxt+40(18).
          APPEND wa_objtxt TO i_objtxt.
          CLEAR: wa_fail, wa_objtxt.
        ENDLOOP.
      ENDIF.
    *  Partial Payment Doc Nos
      READ TABLE i_fail WITH KEY type = c_part
                        TRANSPORTING NO FIELDS
                        BINARY SEARCH.
      IF sy-subrc EQ 0.
        wa_objtxt = text-t17.
        APPEND wa_objtxt TO i_objtxt.
        CLEAR wa_fail.
        CLEAR: wa_objtxt.
        APPEND wa_objtxt TO i_objtxt.
        MOVE: text-t23   TO wa_objtxt,
              text-t24   TO wa_objtxt+17(5),
              text-t25   TO wa_objtxt+22(6),
              text-t26   TO wa_objtxt+40(18).
        APPEND wa_objtxt TO i_objtxt.
        CLEAR wa_objtxt.
        LOOP AT i_fail INTO wa_fail WHERE type EQ c_part.
          DIVIDE wa_fail-disper BY 100.
          MOVE: wa_fail-belnr   TO wa_objtxt,
                wa_fail-buzei   TO wa_objtxt+17(5),
                wa_fail-wrbtr   TO wa_objtxt+22(16),
                wa_fail-disper  TO wa_objtxt+40(18).
          APPEND wa_objtxt TO i_objtxt.
          CLEAR: wa_fail, wa_objtxt.
        ENDLOOP.
      ENDIF.
    * MAIL BODY-LENGTH
      DESCRIBE TABLE i_objtxt LINES l_l1.
      CLEAR wa_objpack-transf_bin.
      wa_objpack-head_start = lc_1.
      wa_objpack-head_num = lc_0.
      wa_objpack-body_start = lc_1.
      wa_objpack-body_num = l_l1.
      wa_objpack-doc_type = lc_raw.
      APPEND wa_objpack TO i_objpack.
    *SUBJECT
      CLEAR wa_doc_chng.
      wa_doc_chng-obj_name  = text-t15.
      wa_doc_chng-obj_descr = text-t15.
    ENDFORM.                    " mail_body
    *&      Form  send_mail
    *       text
    FORM send_mail.
      CONSTANTS: lc_c       TYPE so_escape VALUE 'C',
                 lc_mode(3) TYPE c         VALUE 'INT'.
      CLEAR: wa_reclist, i_reclist[].
    *Recipient list
      wa_reclist-receiver = text-t14.       "DL
      wa_reclist-rec_type = lc_c.
      APPEND wa_reclist TO i_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data                    = wa_doc_chng
            put_in_outbox                    = c_x
    *     IMPORTING
    *       SENT_TO_ALL                      =
    *       NEW_OBJECT_ID                    =
          TABLES
            packing_list                     = i_objpack
    *       OBJECT_HEADER                    =
    *       CONTENTS_BIN                     =
            contents_txt                     = i_objtxt
    *       CONTENTS_HEX                     =
    *       OBJECT_PARA                      =
    *       OBJECT_PARB                      =
            receivers                        = i_reclist
         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.
    *    ENDIF.
      IF sy-subrc IS INITIAL.
    *Send mail immediately
        SUBMIT rsconn01 USING SELECTION-SET lc_mode AND RETURN.
        CALL FUNCTION 'SO_DEQUEUE_UPDATE_LOCKS'.
      ELSE.
        RAISE mail_not_sent.
      ENDIF.
    ENDFORM.                    " send_mail
    Thanks,
    Vinod.

  • Sending mail with attachment fails on MAC Mail and WRP400.

    Sending mail with attachment fails on MAC Mail and WRP400.
    We have hundreds of WRP400 connected with Mac (Machintosh) computers. No special configurations are applied (no virtual server or DMZ). Web navigation, P2P programs and sending mail without attachment work right.
    The problem is the impossibility to send mails with medium or big size files attachment from MAC Mail.
    If we use Windows PCs or a different linksys routers (eg. WRT54G) the problem not happens.
    We have upgraded WRP400 firmware version from 1.00.06 to 2.00.05 but the result is the same. Sending mail with attachment using Mac fails.
    We tried to configure WRP400 with DMZ to a particular MAC. We tried to configure Virtual server on tcp 25 port of a MAC. The result is always the same.
    This is a WRP400 bug? Windows PCs work right. MAC and MAC mail works right with other linksys router.
    We need help. Thanks.

    The problem was fixed since beta firmware 2.00.11.
    I think that this issue was caused from a bug that decrease upload bitrate of WRP400 after some days of activity.
    See more details on Cisco forum under title "WRP400 stops responding after browsing certain websites".
    Thanks.

  • Send a mail with attached file .xls but i got file without

    i tried to send a mail with attached file .xls. but i am able to send the file , we recived the file without file name. please do the same
    thnaks in advance.
    END-OF-SELECTION.
    Populate message body text
    PERFORM POPULATE_EMAIL_MESSAGE_BODY.
    Send file by email as .xls speadsheet
    PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
    TABLES IT_MESSAGE
    IT_ATTACH
    USING P_EMAIL
    'Example .xls documnet attachment'
    'XLS'
    'filename'
    CHANGING GD_ERROR
    GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN EBELP AEDAT MATNR
    UP TO 10 ROWS
    FROM EKPO
    INTO TABLE IT_EKPO.
    ENDFORM. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
    CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
    CON_TAB TYPE X VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    con_cret type c value cl_abap_char_utilities=>CR_LF.
    CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
    INTO IT_ATTACH SEPARATED BY ''.
    CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    LOOP AT IT_EKPO INTO WA_CHAREKPO.
    CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
    WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
    INTO IT_ATTACH SEPARATED BY ''.
    CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
    PIT_ATTACH
    USING P_EMAIL
    P_MTITLE
    P_FORMAT
    P_FILENAME
    P_ATTDESCRIPTION
    P_SENDER_ADDRESS
    P_SENDER_ADDRES_TYPE
    CHANGING P_ERROR
    P_RECIEVER.
    DATA: LD_ERROR TYPE SY-SUBRC,
    LD_RECIEVER TYPE SY-SUBRC,
    LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
    LD_EMAIL LIKE SOMLRECI1-RECEIVER,
    LD_FORMAT TYPE SO_OBJ_TP ,
    LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
    LD_ATTFILENAME TYPE SO_OBJ_DES ,
    LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
    LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
    LD_RECEIVER LIKE SY-SUBRC.
    LD_EMAIL = P_EMAIL.
    LD_MTITLE = P_MTITLE.
    LD_FORMAT = P_FORMAT.
    LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
    LD_ATTFILENAME = P_FILENAME.
    LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
    LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    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 .
    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.
    W_DOC_DATA-SENSITIVTY = 'F'.
    CLEAR T_ATTACHMENT.
    REFRESH T_ATTACHMENT.
    T_ATTACHMENT[] = PIT_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 = '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.
    Populate zreceiver return code
    LOOP AT T_RECEIVERS.
    LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
    ENDLOOP.
    ENDFORM.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM INITIATE_MAIL_EXECUTE_PROGRAM.
    WAIT UP TO 2 SECONDS.
    SUBMIT RSCONN01 WITH MODE = 'INT'
    WITH OUTPUT = 'X'
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
    REFRESH IT_MESSAGE.
    IT_MESSAGE = 'Please find attached a list test ekpo records'.
    APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY

    PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
      TABLES IT_MESSAGE
      IT_ATTACH
      USING P_EMAIL
      'Failed IDOC Analysis report'(020)
      'xls'(021)
      'IDOC_REP'(022)
      CHANGING GD_ERROR
      GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    ENDFORM.                    " F_MAIL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
    *CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
    *CON_TAB TYPE X VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
      constants:
       con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE text-040 text-041 text-042 text-043 text-044 text-045 text-046 text-047 text-048 text-049
      INTO IT_ATTACH SEPARATED BY con_tab.
      CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
      APPEND IT_ATTACH.
      clear IT_ATTACH.
      loop at i_final_t into w_final.
        CONCATENATE
        w_final-mestyp w_final-docnum  w_final-statxt w_final-msgno w_final-rvplant w_final-kunnr w_final-vbeln w_final-credat
                w_final-cretim w_final-flag INTO IT_ATTACH SEPARATED BY con_tab.
        CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
        APPEND IT_ATTACH.
        clear IT_attach.
      endloop.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
    PIT_ATTACH
    USING P_EMAIL
    P_MTITLE
    P_FORMAT
    P_FILENAME
    P_ATTDESCRIPTION
    P_SENDER_ADDRESS
    P_SENDER_ADDRES_TYPE
    CHANGING P_ERROR
    P_RECIEVER.
      DATA: LD_ERROR TYPE SY-SUBRC,
      LD_RECIEVER TYPE SY-SUBRC,
      LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
      LD_EMAIL LIKE SOMLRECI1-RECEIVER,
      LD_FORMAT TYPE SO_OBJ_TP ,
      LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
      LD_ATTFILENAME TYPE SO_OBJ_DES ,
      LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
      LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
      LD_RECEIVER LIKE SY-SUBRC.
      LD_EMAIL = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT = P_FORMAT.
      LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
      LD_ATTFILENAME = P_FILENAME.
      LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    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 .
      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.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_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 = '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.
    Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.
    ENDFORM.                    "SEND_FILE_AS_EMAIL_ATTACHMENT
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM INITIATE_MAIL_EXECUTE_PROGRAM.
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
      WITH OUTPUT = 'X'
      AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
      data: l1(99)    type c,
             l2(15)    type c,
             lt_message         type standard table of solisti1,
             ls_message      like line of lt_message.
      clear ls_message.
      l1 = 'Dear'(007).
      l2 =  'Sir/Madam'(008).
      concatenate l1 l2 ',' into
      ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
    *Assign Message text
      clear ls_message.
      concatenate text-011
                  text-012
                  into ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
    *Assign Message text
      clear ls_message.
      concatenate text-013
                  text-014
                  text-015
                  into ls_message-line separated by space.
      append ls_message to lt_message.
      concatenate text-016
                  text-017
                  into ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
      ls_message-line = text-018.
      append ls_message to lt_message.
      ls_message-line = text-019.
      append ls_message to lt_message.
      clear: ls_message.
      REFRESH IT_MESSAGE.
      it_message[] = lt_message[].
      APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY

  • Convert Script output data to Text(.txt) file & send mail with attachment.

    Hi All,
    Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
    Plese sugget with Function modules to cover as Text file.
    I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
    Thanks in advance.

    Hi, Thanks for responst.
    We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
    Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
    Thanks.

  • Send mails with csv file as an attachment through oracle(SQL SCripts / Stor

    Hello Everybody,
    I have recently come across a requirement in which I am supposed to send mails with csv file as an attachment through oracle(SQL SCripts / Stored Procedure) .
    The contents of the csv file are to be retreived from the Database as well as the content of the mail and to whom it needs to be sent has also to be picked up from the database.
    Can somebody suggest me with a suitable code for the same?
    Would be of great help..!!
    Thanks & Regards,
    - VR
    Edited by: user646716 on Dec 18, 2009 10:44 AM

    read below links
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805
    http://www.orafaq.com/wiki/Send_mail_from_PL/SQL#Send_mail_with_UTL_TCP_-withattachments
    How to send csv file as an attachment

  • Send mail with attachment from the uploaded file

    hi,
    From a form thread i got the following code to send mail with attachment with the file uploaded from the file upload ui element.
    public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionLoadFile(ServerEvent)
         WDWebResourceType FileType = null;
         String FileName = new String();
              //get attribute info for context attribute 'FileUpload'
              IWDAttributeInfo attributeInfo =
                   wdContext.getNodeInfo().getAttribute(
                        IPrivateEmailView.IContextElement.FILE_UPLOAD);
              //get modifiable binary type from the attribute info,requires type cast.
              IWDModifiableBinaryType binaryType =
                   (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
              IPrivateEmailView.IContextElement element =
                   wdContext.currentContextElement();
              //if a file in the 'FileResource' attribute exists
              if (element.getFileUpload() != null) {
                   try {
                        String mimeType = binaryType.getMimeType().toString();
                        byte[] file = element.getFileUpload();
                        //get the size of the uploaded file
                        element.setFileSize(this.getFileSize(file));
                        //get the extension of the uploaded file
                        element.setFileExtension(binaryType.getMimeType().getFileExtension());
                        //NOTE: context attribute 'FileName' must not be set
                        //because the FileUpload-UI-element property 'fileName'
                        //is bound to it. Consequently the fileName is automatically
                        //written to the context after file upload.
                        //report success message
                        wdComponentAPI.getMessageManager().reportMessage(
                        IMessageEmailComp.SF_UPLOAD,
                             new Object[] { binaryType.getFileName()},
                             false);
                        FileType = binaryType.getMimeType();
                        FileName = binaryType.getFileName();
                   } catch (Exception e) {
                        throw new WDRuntimeException(e);
              //if no file in the 'FileResource' attribute exists
              else {
                   //report error message
                   IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
                   msgMgr.reportContextAttributeMessage(
                        element,
                        attributeInfo,
                        IMessageEmailComp.NO_FILE,
                        new Object[] { "" },
                        true);
              //clear the FileResource context value attribute
              //element.setFileUpload(null);
              String URL;
              URL = this.CreateAndGetPathFileUpload(
                                  wdContext.currentContextElement().getFileUpload(),
                                                      FileName);
    //          if (URL.length() == 1){
    //               //ERRORE
         wdContext.currentContextElement().setPATHFileUploaded(URL);
        //@@end
      public boolean send( java.lang.String subj, java.lang.String mess, java.lang.String dest, java.lang.String attach, java.lang.String FileName )
        //@@begin send()
         InitialContext ctx = null;
         Address[] address = null;
         Message msg = null;
         Session sess = null;
         MimeBodyPart bodyPart = null;
         Multipart mp = null;
         // "141.29.193.71" == milvl2ja.icn.siemens.it (SMTP di Siemens)
           try {
              Properties props = new Properties();
              props.put("domain","true");
              ctx = new InitialContext(props);
              sess = (Session) ctx.lookup("java:comp/env/mail/MailSession");
              msg = new MimeMessage(sess);
              IWDClientUser utente = WDClientUser.getCurrentUser();
              String senderEmail = utente.getSAPUser().getEmail();
              InternetAddress addressFrom = new InternetAddress(senderEmail);
              msg.setFrom(addressFrom);     
              String EmailDEST = dest;
              InternetAddress addressTo = new InternetAddress(EmailDEST);
              msg.setRecipient(Message.RecipientType.TO, addressTo);
              msg.setSubject(subj);
    //          if ((mess != null) && (mess.length()>0)) {
    //                 msg.setContent(mess, "text/plain");
    //            } else {
    //                 msg.setContent("", "text/plain");
              //Gestione ATTACHMENT...
              String attachedFileName = new String(wdContext.currentContextElement().getFileName());
              boolean hasAttachment = (attachedFileName != null) && (attachedFileName.length() > 0);
              boolean isMultiPart = (mess != null) && (mess.length() > 1);
              //adding an attachment makes the message multipart
                 if (isMultiPart || hasAttachment) {
                    mp = new MimeMultipart();
                    // add text parts
                      if (mess != null) {
                         for (int i = 0; i < mess.length(); i++) {
                           bodyPart = new MimeBodyPart();
                           bodyPart.setContent(mess,"text/plain");
                           mp.addBodyPart(bodyPart);
                    //attach the file to the message if needed
                    if (hasAttachment) {     // avoid the case with no text parts
                         bodyPart = new MimeBodyPart();
                           bodyPart.setContent("Allegato incluso nel messaggio.","text/plain");
                           mp.addBodyPart(bodyPart);
                           // the part with the file
                           FileDataSource fds = new FileDataSource(attach);
                           MimeBodyPart attachmentBodyPart = new MimeBodyPart();
                        attachmentBodyPart.setDataHandler(new DataHandler(fds));
                        //URL URLattachedFileName = new URL(attach);
                        //attachmentBodyPart.setDataHandler(new DataHandler(URLattachedFileName));
                           attachmentBodyPart.setFileName(FileName);
                           mp.addBodyPart(attachmentBodyPart);
                    msg.setContent(mp);
                 } else {
                    if ((mess != null) && (mess.length() > 0)) {
                         msg.setContent(mess, "text/plain");
                    } else {
                         msg.setContent("", "text/plain");
              //fine ATTACHMENT 
              msg.setSentDate(new GregorianCalendar().getTime());
              msg.saveChanges();
              address = msg.getAllRecipients();
              Transport.send(msg, address);
           } catch (Exception e) {
                 e.printStackTrace();
                 return false;
           return true;
        //@@end
    When i used the same code in my application i am gett ing error in many places..
    1)FileDataSource fds = new FileDataSource(<b>attach</b>);
    attach cannot be resolved
    2)attachmentBodyPart.setFileName(<b>FileName</b>);
    fliename cannot be resolved
    3)byte[] file = element.getFileUpload();
    type mismatch cannot convert sting to byte[]
    4)element.setFileSize(this.getFileSize(file));
    method getFileSize() is undefined
    5)element.setFileExtension(binaryType.getMimeType().getFileExtension());
    method getFilExtension() is undefined
    6)URL = this.CreateAndGetPathFileUpload(wdContext.currentContextElement().getFileUpload(),FileName);
    method CreateAndGetPathFileUpload() is undefined.
    7)wdContext.currentContextElement().setPATHFileUploaded(URL);
    from the above error i can understand that only i have got the part of the code.
    Please send me the complete coding.
    some method definitions are missing....
    Please help me to send the mail with attachment from the file uploaded from the file upload ui element.
    Thanks in advance,
    shami.

    hi,
    I got this from the following link
    Re: Attaching an excel file
    plz help me ...
    I am using 2004s with nwds 7.0.06.
    also tell me what should be the type of the context variable FileUpload
    Thanks in advance,
    shami.

  • Sending Mail with attachment and preserving the order of attachment

    Hi Everyone!!!!!!
    My requirement is to send Email with attachment in the same order as they were attached by Sender while composing the mail. I want to preserve order of attachment in the mail and when receiver open a mail, the attached files should be reflected in same order as it was on sender side. In my application,the documents being upload are already in my database. So, user just requires to mark the corresponding check box and enter the Sequence number for each attachment. When he clicks on "SEND" button, the Source file is first written from database to OS level and then files are attached from source available on OS . The attached file name could be anything. Based on the Sequence number file should be attached and send. My current code works fine,but problem it is that the Sequence number is not preserved in my attachment . However, when I traced the output of FOR Loop by inserting it in a table " temp_trace" I found that the Sequence is preserved in the order that I want. So, I think that uploaded files are written on the Operating system in same order but they are not attached in same order. Below is the sample code that is I am using to attach file in email. Here, the user_sequence is the sequence number entered by user.
    for i in (select case when user_sequence is not null
    then trim(to_char(user_sequence ,'09'))||'_'||file_name||'.pdf'
    else ||'_'||file_name||'.pdf' end file_name ,
    file_src,length(file_src) len,cd.doc_id,PRIORITY from
    MIM_CLIENT_DOCS CD,(select DOC_ID ,user_sequence from table P_DOC_AND_user_sequence ) TEMP_TAB
    WHERE CD.DOC_ID = TEMP_TAB.DOC_ID order by case when user_sequence is null then 1 else 0 end, file_name)
    loop
    insert into temp_trace values(i.file_name);
    L_OUT := UTL_FILE.FOPEN(v_oracle_dir,i.file_name,'wb',32760);
    end loop;
    I want my output as
    1_first attachment.txt
    2_second_attachment.docx
    3_abc.sql
    _xxx.txt  ------------------ When sequence is not assigned by user That is null at last.
    Unfortunately, I am not getting attachment in mail in this sequence. Can anyone give me suggestion.
    Sorry for stuff essay and thanks in advance!!!!!!!!!!!

    >
    Please update your forum profile with a real handle instead of "974850".
    My requirement is to send Email with attachment in the same order as they were attached by Sender while composing the mail. I want to preserve order of attachment in the mail and when receiver open a mail, the attached files should be reflected in same order as it was on sender side. In my application,the documents being upload are already in my database. So, user just requires to mark the corresponding check box and enter the Sequence number for each attachment. When he clicks on "SEND" button, the Source file is first written from database to OS level and then files are attached from source available on OS . The attached file name could be anything. Based on the Sequence number file should be attached and send. My current code works fine,but problem it is that the Sequence number is not preserved in my attachment . However, when I traced the output of FOR Loop by inserting it in a table " temp_trace" I found that the Sequence is preserved in the order that I want. So, I think that uploaded files are written on the Operating system in same order but they are not attached in same order. Below is the sample code that is I am using to attach file in email. Here, the user_sequence is the sequence number entered by user.Always post code using <tt>\...\</tt> tags as described in the FAQ.
    for i in (select case when  user_sequence is not null
    then trim(to_char(user_sequence ,'09'))||'_'||file_name||'.pdf'
    else  ||'_'||file_name||'.pdf' end file_name ,
    file_src,length(file_src) len,cd.doc_id,PRIORITY from
    MIM_CLIENT_DOCS CD,(select DOC_ID ,user_sequence from table P_DOC_AND_user_sequence ) TEMP_TAB
    WHERE CD.DOC_ID = TEMP_TAB.DOC_ID order by case when user_sequence is null then 1 else 0 end, file_name)                               
    loop
    insert into temp_trace values(i.file_name);
    L_OUT := UTL_FILE.FOPEN(v_oracle_dir,i.file_name,'wb',32760);
    end loop;I want my output as
    1_first attachment.txt
    2_second_attachment.docx
    3_abc.sql
    _xxx.txt  ------------------ When sequence is not assigned by user That is null at last.
    Unfortunately, I am not getting attachment in mail in this sequence. Can anyone give me suggestion.I see no code that attaches anything to email messages. What code is used to do this? Why are the files being written to the file system?

  • Java mail with attach file

    Hi , I need a example with java send mail can attach a file
    thnak you

    Hey cool... thanking you phdk. Ta.
    package krc.utilz;
    import java.util.Properties;
    import java.io.File;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.Message;
    import javax.mail.Multipart;
    import javax.mail.BodyPart;
    import javax.mail.MessagingException;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.InternetAddress;
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
    import javax.mail.PasswordAuthentication;
    public class Emailz
      private static class MyAuthenticator extends javax.mail.Authenticator {
        @Override
        protected PasswordAuthentication getPasswordAuthentication(){
          return new PasswordAuthentication("#########", "#########" ); // <<<<<<<<<<<<<<<<<<<
      private static final Properties props = new Properties();
      static {
        props.put("mail.smtp.host", "smtp.googlemail.com");
        props.put("mail.smtp.port", "465");
        props.put("mail.smtp.user", "########"); // <<<<<<<<<<<<<<<<<<<
        //props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.debug", "true");
        props.put("mail.smtp.socketFactory.port", "465");
        props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
        props.put("mail.smtp.socketFactory.fallback", "false");
      public static void send(String subject, String message, String from, File[] attachments, String... recipients)
        throws MessagingException
        Session session = Session.getDefaultInstance(props, new MyAuthenticator());
        session.setDebug(true);
        // head
        Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress(from));
        InternetAddress[] addressTo = new InternetAddress[recipients.length];
        for (int i=0; i<recipients.length; i++) {
          addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    msg.setSubject(subject);
    // body
    Multipart multipart = new MimeMultipart();
    // message
    BodyPart msgPart = new MimeBodyPart();
    msgPart.setText(message);
    multipart.addBodyPart(msgPart);
    // attachments
    for ( File attachment : attachments ) {
    MimeBodyPart attPart = new MimeBodyPart();
    attPart.setDataHandler(new DataHandler(new FileDataSource(attachment)));
    attPart.setFileName(attachment.getName());
    multipart.addBodyPart(attPart);
    msg.setContent(multipart);
    Transport.send(msg);
    public static void main(String[] args) {
    try {
    //send(String subject, String message, String from, File[] attachments, String... recipients)
    send(
    "Testing attachments" // subject
    , "This is an email with an attachment" // message
    , "########@gmail.com" // from // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    , new File[] {new File("C:/Java/home/src/krc/utilz/Emailz.java")} // attachments
    , "########@gmail.com" // to // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    } catch (Exception e) {
    e.printStackTrace();
    Cheers. Keith.

  • Send mail with attachment from webdynpro application

    hi,
    From a webdynpro application, the user will upload any files through the File upload ui element.These uploaded files has to go as an attachment in the mail which is being send to a particular ID ,when the user clicks the submit button in the form.
    can you please give me the code regarding this and help me in sending mail with attachment from a webdynpro application.
    Thanks in advance,
    shami.

    Hai,
    Properties props = System.getProperties();
           props.put("mail.smtp.host", "xx.xx.x.xx");
           Session session = Session.getDefaultInstance(props, null);
           Message msg = new MimeMessage(session);
           msg.setFrom(new InternetAddress("[email protected]"));
           msg.setRecipients(Message.RecipientType.TO,
           InternetAddress.parse("[email protected]", false));
           msg.setSubject(subject);
           msg.setText(body);
           msg.setHeader("X-Mailer", " Email");
           msg.setSentDate(new Date());
           MimeBodyPart messageBodyPart = new MimeBodyPart();
           messageBodyPart.setText("Hai , This mail Generated By the  Program");
          Multipart multipart = new MimeMultipart();
           multipart.addBodyPart(messageBodyPart);
            messageBodyPart = new MimeBodyPart();
            DataSource source = new FileDataSource("C:\nag.xls");//Here you need to give the Path of uploaded File
            messageBodyPart.setDataHandler( new DataHandler(source));
            messageBodyPart.setFileName("nag.xls");
            multipart.addBodyPart(messageBodyPart);
            // Put parts in message
            msg.setContent(multipart);
           Transport.send(msg);
    Regards,
    Naga

Maybe you are looking for

  • Safely unmounting a Raid 5 array from Mac Pro Nehalem

    Forgive my ignorance but I am very green when it comes to Raid set-ups. I'm a editor and I'm in the process of setting up a RAID 5 as follows: Highpoint RocketRaid 4322 Controller card in top PCI slot, running mini SAS cable to, Proavio 8 drive Enclo

  • Mysterious duplicates in Bridge

    I store all of my files on an external hard drive connected to my iMac and then access them both from my iMac and from my MacBook over the network. I often experience duplicate files when doing full screen previews and also in viewing the thumbnails.

  • Since my maverick update i now have blurry screen help???

    Since my maverick update i now have blurry screen. writing is blurred and pictures are blurred, its like i need glasses to focus properly. any ideas???? its like everything is out of focus HELPP!!!

  • Error in duplicating dataguard, RMAN-04006: error from auxiliary,ORA-12514

    Hi All, Trying to duplicate using rman and facing below issue rman TARGET sys/oracle@pawsdb AUXILIARY sys/oracle@adpaws Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jun 19 20:47:09 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliat

  • display:table.... /display:table   export problem

    HI, when I wrote in the jsp: <display:table pagesize="30" class="isis" name="contacts" export="true"> <display:column property="firstName"/> <display:column property="lastName"/> <display:column property="title"/> <display:column property="gender"/>