Sent attachment with pl/sql as a mail with ( mulitpel recepents )

Hi,
I have an requirement ,like send a particular file as attachment.
i have done the same... but the issue is i need to send the file to multiple recipients that was based on the user provided value.
Ex: [email protected];[email protected];[email protected];
but i am able to send only one recipient( [email protected] ) at a time can we send the same for multiple recipients...please suggest me ...
Please find the code i have written : It's working for single user( address)
declare
v_location VARCHAR2 (1000) := '/u01/share/';
v_file_id_num UTL_FILE.file_type;
v_file_name VARCHAR2 (2000):= 'o1296075.out';
v_from VARCHAR2 (80) := '[email protected]';
v_recipient VARCHAR2 (80) := 'chiru_sati.yahoo.com';
--v_cc VARCHAR2 (80) := '';
v_subject VARCHAR2 (80) := ' Chiru Test';
v_mail_host VARCHAR2 (30) := '192.168.10.25';
v_data VARCHAR2 (32000) := NULL;
crlf VARCHAR2 (2) := CHR (13) || CHR (10);
c UTL_TCP.connection;
rc INTEGER;
vSFile UTL_FILE.file_type;
vNewLine VARCHAR2(2000);
v_descriptor VARCHAR2(50);
v_count number ;
BEGIN
begin
select ( LENGTH(myfield)- LENGTH(REPLACE(myfield,';',''))) + ( LENGTH(myfield)- LENGTH(REPLACE(myfield,',',''))) into v_count from dual;
exception WHEN others then
v_count := 0 ;
end;
c := utl_tcp.open_connection('192.168.10.25', 25);
rc := utl_tcp.write_line(c, 'HELO 192.168.10.25');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'EHLO 192.168.10.25');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'MAIL FROM: '||v_from);
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'RCPT TO: '||v_recipient);
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'DATA');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'Date: '||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ));
rc := utl_tcp.write_line(c, 'From: '||v_from||' <'||v_from||'>');
rc := utl_tcp.write_line(c, 'MIME-Version: 1.0');
rc := utl_tcp.write_line(c, 'To: '||v_recipient||' <'||v_recipient||'>');
rc := utl_tcp.write_line(c, 'Subject: '||v_subject);
rc := utl_tcp.write_line(c, 'Content-Type: multipart/mixed;');
rc := utl_tcp.write_line(c, ' boundary="-----SECBOUND"');
rc := utl_tcp.write_line(c,'');
rc := utl_tcp.write_line(c, '-------SECBOUND');
rc := utl_tcp.write_line(c, 'Content-Type: text/plain');
rc := utl_tcp.write_line(c, 'Content-Transfer-Encoding: 7bit');
rc := utl_tcp.write_line(c,'');
rc := utl_tcp.write_line(c, ' Please use the file name '||substr(v_file_name,1,length(v_file_name )-4)||'.txt when running the order import program for mass mailing.'); ----- TEXT OF EMAIL MESSAGE
rc := utl_tcp.write_line(c,'');
rc := utl_tcp.write_line(c, '-------SECBOUND');
rc := utl_tcp.write_line(c, 'Content-Type: text/plain;');
rc := utl_tcp.write_line(c, ' name="Test.txt"');
rc := utl_tcp.write_line(c, 'Content-Transfer_Encoding: 8bit');
rc := utl_tcp.write_line(c, 'Content-Disposition: attachment;');
rc := utl_tcp.write_line(c, ' filename='||'"'||substr(v_file_name,1,length(v_file_name )-4)||'.pdf"');
rc := utl_tcp.write_line(c,'');
BEGIN
vSFile := utl_file.fopen(v_location, v_file_name ,'r');
IF utl_file.is_open(vSFile) THEN
LOOP
BEGIN
utl_file.get_line(vSFile, vNewLine);
IF vNewLine IS NULL THEN
EXIT;
END IF;
rc := utl_tcp.write_line(c,vNewLine);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
COMMIT;
END IF;
utl_file.fclose(vSFile);
END;
rc := utl_tcp.write_line(c, '-------SECBOUND--');
rc := utl_tcp.write_line(c,'');
rc := utl_tcp.write_line(c, '.');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'QUIT');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
utl_tcp.close_connection(c);
EXCEPTION
when others then
raise_application_error(-20000, SQLERRM);
END;

If the attachment is also on the server (it needs to be on the server), you could load it into a BLOB and attach that to your email (you will need to create an Oracle directory that points to the file to be attached).
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805#68529763836665
That thread is pretty large, maybe a ctrl+f's over there might give you some clues.
Currently I don't have the mail api available over here, but I still have it on a 'test/playground DB', so I'll have a look later, when I have some time and back from location.

Similar Messages

  • 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

  • Os x lion mail does not save icloud sent email with attachment

    os x lion mail does not save icloud sent email with attachment... are there people who experience the same problem? i was with Apple Support via chat and he could not resolve the problem. I was given a phone number to call, i assume it's tech support for OS X or Mail but I did not have time to be on the phone for a long time... thank you

    I finally fixed it! I verified and repaired disk permissions on my Mac... how come the Apple Tech Guy didn't know that???!!!! Shocking

  • Need Java Coding to sent File in a Mail Attachment with MIME Type with SMTP

    Hi Experts,
      I need java code to sent a file in an email attachment with MIME type.
      Please provide me.
    TYhanks
    Bhaskar

    Hi Stefan,
      Thanks for your Blog.
    The same java mapping is been used in my current system, but the legacy system cannot read
    some emails as they are asking us to send the email in MIME format.
    Already i am sending in MIME format itself.
    They can read some Emails and they cannot ream some Emails.
    I think the problem could be their exchange server.
    Can you please suggest on this.
    Regards,
    Bhaskar

  • Want to Send smartform as pdf attachment with a Email to some mail id

    Hi ,
    I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
    But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
    By debugging I come to know that the file which is generating is in some encoding format.
    Please help me regard this. This is very urgent.
    here is the code,
    Main Program :
    REPORT Ztest_report.
    *--Top Include for Global Data Declarations.
    INCLUDE ztest_report_top.
    *--Form Include for Form Routines.
    INCLUDE ztest_report_form.
    START-OF-SELECTION.
    START-OF-SELECTION.
    *--Display data
      Perform display_data.
    END-OF-SELECTION.
    Top declaration :
    Internal table
    DATA :  i_otfdata TYPE tsfotf,          " Smart Forms: Table OTF
            i_tline TYPE TABLE OF tline WITH HEADER LINE,
            i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
            i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
            i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
            w_mailaddr TYPE ppfdmailad,
            w_mailtype TYPE so_escape,
            w_mailrecipient TYPE swotobjid,
            w_control TYPE ssfctrlop,
            w_compop TYPE ssfcompop,
            w_return TYPE ssfcrescl,
            wa_doc_chng TYPE sodocchgi1,
            w_data TYPE sodocchgi1,
            wa_buffer TYPE string, "To convert from 132 to 255
            wa_objhead TYPE soli_tab,
    Variables declarations
            v_form_name TYPE rs38l_fnam,
            v_len_in LIKE sood-objlen,
            v_len_out LIKE sood-objlen,
            v_len_outn TYPE i,
            v_lines_txt TYPE i,
            v_lines_bin TYPE i.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
    PARAMETER:      p_bukrs TYPE bukrs OBLIGATORY,            "Company Code
                    p_belnr TYPE belnr_d OBLIGATORY,          "Document No
                    p_gjahr TYPE gjahr OBLIGATORY,            "document type
                    p_mailid(50) TYPE c OBLIGATORY.
    "Mail Id
    SELECTION-SCREEN END OF BLOCK blk1.
    Form Logic :
    FORM display_data.
    *Local Variable declaration
      DATA: lc_fm TYPE rs38l_fnam,       "local variable to store the
            l_i_document_output_info TYPE ssfcrespd,
            l_i_struc_job_output_info TYPE ssfcrescl,
            l_i_struc_job_output_options TYPE ssfcrescl,
            i_lines TYPE TABLE OF tline WITH HEADER LINE,
            lv_job_output_info      TYPE ssfcrescl,
            lv_document_output_info TYPE ssfcrespd,
            lv_job_output_options   TYPE ssfcresop,
            lv_bin_filesize         LIKE sood-objlen.
    Determine the smartform name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                formname           = 'ZTEST_SMARTFORM'
           IMPORTING
                fm_name            = lc_fm
           EXCEPTIONS
                no_form            = 1
                no_function_module = 2
                OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      w_control-getotf = 'X'.
      w_control-no_dialog = 'X'.
      w_control-preview = space.
    w_control-device = 'MAIL'.
    Call the smartform and pass the selection screen parameter
      CALL FUNCTION lc_fm
           EXPORTING
                control_parameters = w_control
                output_options     = w_compop
                user_settings      = 'X'
                t_bukrs            = p_bukrs
                t_belnr            = p_belnr
                t_gjahr            = p_gjahr
           IMPORTING
                job_output_info    = l_i_struc_job_output_info
           EXCEPTIONS
                formatting_error   = 1
                internal_error     = 2
                send_error         = 3
                user_canceled      = 4
                OTHERS             = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Moving the Smart Forms: Table OTF into an internal table
      i_otfdata[] = l_i_struc_job_output_info-otfdata[].
    CONVERT TO OTF TO PDF.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = lv_bin_filesize
           TABLES
                otf                   = i_otfdata
                lines                 = i_lines
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
    IF sy-batch EQ l_c_no.
    To directly view the print-preview in PDF format
      CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
           EXPORTING
                i_otf                    = i_otfdata
           EXCEPTIONS
                convert_otf_to_pdf_error = 1
                cntl_error               = 2
                OTHERS                   = 3.
    For Sending the PDF file to a Mail ID.
    LOOP AT i_lines.
       TRANSLATE i_lines USING '~'.
       CONCATENATE wa_buffer i_lines INTO wa_buffer.
    ENDLOOP.
    TRANSLATE wa_buffer USING '~'.
    DO.
       i_record = wa_buffer.
       APPEND i_record.
       SHIFT wa_buffer LEFT BY 255 PLACES.
       IF wa_buffer IS INITIAL.
         EXIT.
       ENDIF.
    ENDDO.
      DATA: BEGIN OF zlines OCCURS 0,
      tline TYPE char255,
      END OF zlines.
    *Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                transfer_bin                = 'X'
           TABLES
                content_in                  = i_lines
                content_out                 = zlines
           EXCEPTIONS
                err_line_width_src_too_long = 1
                err_line_width_dst_too_long = 2
                err_conv_failed             = 3
                OTHERS                      = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = zlines[].
    Create Message Body Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Attachment (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
    I_OBJPACK-DOC_TYPE = 'RAW'.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size = v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      APPEND i_objpack.
      CLEAR i_reclist.
      i_reclist-receiver = p_mailid.
      i_reclist-rec_type = 'U'.
      APPEND i_reclist.
    Send new document with attachments via RFC
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = wa_doc_chng
                put_in_outbox              = 'X'
                commit_work                = 'X'
           TABLES
                packing_list               = i_objpack
                object_header              = wa_objhead
                contents_bin               = i_objbin
                contents_txt               = i_objtxt
                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.
        WRITE:/ 'Error When Sending the File', sy-subrc.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.
    ENDFORM.                    " display_data

    hi,
    i wrote a programm.for me it is working.i think it will help for u.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = form_name
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'mail id'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = WA_DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_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.
      WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
      WRITE:/ 'Mail sent'.
    ENDIF.
    please reward me if helpful.

  • Sending XI-Content as Mail Attachement with specific Filename

    Hi,
    I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
    In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
    Is this possible and how?
    Thank you for your help
    Thomas

    Hi Thomas,
    You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
    In the Mail Receiver Channel got to tab "Module"
    As first module (before the mail module) enter:
    localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
    For this module key you can use in the module configuration following entries:
    Transform.ContentDisposition inline|attachment;filename=<filename>
    Transform.ContentDescription <Filename>
    Transform.ContentType <MimeType>/<SubType>;name="<filename>"
    If you want to send an attachment, use:
    Transform.ContentDisposition attachment;filename="MyFile.csv"
    Transform.ContentDescription MyFile
    Transform.ContentType text/plain;name="MyFile.csv"
    If you use the Mail Package, you can set the file name that way:
    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
      <Subject>Hello</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Content_Type>text/plain;name="MyFile.csv"</Content_Type>
      <Content>Here comes the CSV Data</Content>
    </ns:Mail>
    Hope that helps,
    Stefan

  • Sapscript via mail: attachment with body

    Hi all
    I need your opinion in order to solve the problem in object
    I've an old bill message to be sent via mail, so I've set the customizing by NACE and now it works fine
    The problme is the sapscript is attached to e-mail as pdf but any text is inserted to body mail:
    any text can't be inserted: I saw the note 753622 (Sending of body text and PDF attachment with medium 5), it speaks clearly, it's not possible to add a text.
    So the only solutions seem to be:
    - to try to change the form function in order to add a text as note [like here|Setting Mail Subject and Body;
    - Send the mail by your self (getting OTF data) 
    How have you solve it?
    Thanks
    Max

    Hi Max,
    If I need any sort of email body for an output-based email, I always implement a custom processing routine with mode '5' or mode '8' and leverage existing data retrieval calls where possible.  As you've seen, SAP's output processing options are very limited and clumsy for email processing.  A more professional HTML email body is the way to go - your best option is to handle it yourself.
    Brad

  • Need to send an attachment with the mail to the distribution list

    Hi all,
    How do I send an <b>attachment</b> with the e-mail to a distribution list?
    I am using the FMs <b>SO_DLI_EXPAND</b> and <b>SO_OBJECT_SEND</b> to expand the distribution list and send mail to the distribution list respectively.I am getting the contents of the file in the email that is being sent. The file is being extracted from UNIX.
    However, the contents of the file has to go as an attachment.
    Please assist.
    Thanks and regards,
    Anishur

    Hello,
    You can do it like this...using SapScript:
    REPORT YMAIL.
    DATA: ITCPO LIKE ITCPO,
    TAB_LINES LIKE SY-TABIX.
    Variables for EMAIL functionality
    DATA: MAILDATA LIKE SODOCCHGI1.
    DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
    DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
    DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    PERFORM SEND_FORM_VIA_EMAIL.
    FORM SEND_FORM_VIA_EMAIL *
    FORM SEND_FORM_VIA_EMAIL.
    CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
    REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
    Creation of the document to be sent File Name
    MAILDATA-OBJ_NAME = 'TEST'.
    Mail Subject
    MAILDATA-OBJ_DESCR = 'Subject'.
    Mail Contents
    MAILTXT-LINE = 'Here is your file, would you check it?'.
    APPEND MAILTXT.
    Prepare Packing List
    PERFORM PREPARE_PACKING_LIST.
    BREAK gpulido.
    Set recipient - email address here!!!
    <b>*MAILREC-RECEIVER = '[email protected]'.
    MAILREC-RECEIVER = '[email protected]'.
    MAILREC-REC_TYPE = 'U'.</b>
    APPEND MAILREC.
    Set recipient - email address here!!!
    *MAILREC-RECEIVER = 'BGIRALDO'.
    *MAILREC-REC_TYPE = 'B'.
    *APPEND MAILREC.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = MAILDATA
    PUT_IN_OUTBOX = 'X'
    TABLES
    PACKING_LIST = MAILPACK
    OBJECT_HEADER = MAILHEAD
    CONTENTS_BIN = MAILBIN
    CONTENTS_TXT = MAILTXT
    RECEIVERS = MAILREC
    EXCEPTIONS
    TOO_MANY_RECEIVERS = 1
    DOCUMENT_NOT_SENT = 2
    OPERATION_NO_AUTHORIZATION = 4
    OTHERS = 99.
    submit rsconn01 with mode = 'INT' and return.
    CASE SY-SUBRC.
    WHEN 0.
    WRITE: / 'Result of the send process:'.
    LOOP AT MAILREC.
    WRITE: / mailrec-RECEIVER(48), ':'.
    IF mailrec-RETRN_CODE = 0.
    WRITE 'sent successfully'.
    ELSE.
    WRITE 'not sent'.
    ENDIF.
    ENDLOOP.
    WHEN 1.
    WRITE: / 'no authorization to send to the specified number of'
    WHEN 2.
    WRITE: / 'document could not be sent to any of the recipients!'.
    WHEN 4.
    WRITE: / 'no authorization to send !'.
    WHEN OTHERS.
    WRITE: / 'error occurred during sending !'.
    ENDCASE.
    ENDFORM.
    Form PREPARE_PACKING_LIST
    FORM PREPARE_PACKING_LIST.
    CLEAR: MAILPACK, MAILBIN, MAILHEAD.
    REFRESH: MAILPACK, MAILBIN, MAILHEAD.
    DESCRIBE TABLE MAILTXT LINES TAB_LINES.
    READ TABLE MAILTXT INDEX TAB_LINES.
    MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
    Creation of the entry for the compressed document
    CLEAR MAILPACK-TRANSF_BIN.
    MAILPACK-HEAD_START = 1.
    MAILPACK-HEAD_NUM = 0.
    MAILPACK-BODY_START = 1.
    MAILPACK-BODY_NUM = TAB_LINES.
    MAILPACK-DOC_TYPE = 'RAW'.
    APPEND MAILPACK.
    Creation of the document attachment
    This form gets the OTF code from the SAPscript form.
    If you already have your OTF code, I believe that you may
    be able to skip this form. just do the following code, looping thru
    your SOLISTI1 and updating MAILBIN.
    PERFORM GET_OTF_CODE.
    LOOP AT SOLISTI1.
    MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
    APPEND MAILBIN.
    ENDLOOP.
    DESCRIBE TABLE MAILBIN LINES TAB_LINES.
    MAILHEAD = 'TEST.OTF'.
    APPEND MAILHEAD.
    Creation of the entry for the compressed attachment
    MAILPACK-TRANSF_BIN = 'X'.
    MAILPACK-HEAD_START = 1.
    MAILPACK-HEAD_NUM = 1.
    MAILPACK-BODY_START = 1.
    MAILPACK-BODY_NUM = TAB_LINES.
    MAILPACK-DOC_TYPE = 'OTF'.
    MAILPACK-OBJ_NAME = 'TEST'.
    MAILPACK-OBJ_DESCR = 'Subject'.
    MAILPACK-DOC_SIZE = TAB_LINES * 255.
    APPEND MAILPACK.
    ENDFORM.
    Form GET_OTF_CODE
    FORM GET_OTF_CODE.
    DATA: BEGIN OF OTF OCCURS 0.
    INCLUDE STRUCTURE ITCOO .
    DATA: END OF OTF.
    DATA: ITCPO LIKE ITCPO.
    DATA: ITCPP LIKE ITCPP.
    CLEAR ITCPO.
    ITCPO-TDGETOTF = 'X'.
    Start writing OTF code
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    FORM = 'YSEND_MAIL'
    LANGUAGE = SY-LANGU
    OPTIONS = ITCPO
    DIALOG = ' '
    EXCEPTIONS
    OTHERS = 1.
    CALL FUNCTION 'START_FORM'
    EXCEPTIONS
    ERROR_MESSAGE = 01
    OTHERS = 02.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    WINDOW = 'MAIN'
    EXCEPTIONS
    ERROR_MESSAGE = 01
    OTHERS = 02.
    Close up Form and get OTF code
    CALL FUNCTION 'END_FORM'
    EXCEPTIONS
    ERROR_MESSAGE = 01
    OTHERS = 02.
    MOVE-CORRESPONDING ITCPO TO ITCPP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
    RESULT = ITCPP
    TABLES
    OTFDATA = OTF
    EXCEPTIONS
    OTHERS = 1.
    Move OTF code to structure SOLI form email
    CLEAR SOLISTI1. REFRESH SOLISTI1.
    LOOP AT OTF.
    SOLISTI1-LINE = OTF.
    APPEND SOLISTI1.
    ENDLOOP.
    Reward points if helpful.
    Thanks
    Message was edited by:
            Pattan Naveen

  • PO Attachment with mail.

    Hi all,
    Right now I am functioning on Oracle finance and I am stuck .I will grateful if you make available me any solution or any hint.
    Step:
    1)     User will create PO orders .
    2)     He/She will approve PO orders.
    3)     After User will attaché couple of Document e.g. *.doc,*.els etc…with this PO Orders.
    4)     Now once user will click on approve button standard orders will sent to supplier with attached PDF(this PDF file will create Oracle internally and attached with mail) file.
    Que : Here supplier will get email with only standard attachment not all other *.doc and *.els with is attached with current order. I would like to change this development and want to attach all attachment along with Stand orders PDF.
    Note : This process is calling one JAVA Concurrent Prog : (PO Output for Communication)
    Thanks Looking for response.
    Thanks
    Raj

    Hi all,
    Right now I am functioning on Oracle finance and I am stuck .I will grateful if you make available me any solution or any hint.
    Step:
    1)     User will create PO orders .
    2)     He/She will approve PO orders.
    3)     After User will attaché couple of Document e.g. *.doc,*.els etc…with this PO Orders.
    4)     Now once user will click on approve button standard orders will sent to supplier with attached PDF(this PDF file will create Oracle internally and attached with mail) file.
    Que : Here supplier will get email with only standard attachment not all other *.doc and *.els with is attached with current order. I would like to change this development and want to attach all attachment along with Stand orders PDF.
    Note : This process is calling one JAVA Concurrent Prog : (PO Output for Communication)
    Thanks Looking for response.
    Thanks
    Raj

  • HT2614 Help! How do I open a winmail.dat attachment with my Mac OS 10.6.8 & Mail 4.6 (1085) Thank you.

    Help! How do I open a winmail.dat attachment with my Mac OS 10.6.8 & Mail 4.6 (1085) Thank you.

    Winmail. dat file is attachments sent by Microsoft mail applications (Outlook, Outlook Express or Exchange) on a proprietary format called TNEF. Being a non-standard attachment format, users from other e-mail clients (like Thunderbird or Lotus Notes) or platforms (like Android, Apple, iPad or iPhone) cannot natively read them. But you can open it easily with a winmail viewer. Go to download one and good luck!

  • When I send or receive e-mails, the icon showing that there is an attachment with the e-mail may or may not appear. I have spoken to Apple and they cannot fix.

    When I send or receive e-mails, the icon showing that there is an attachment with the e-mail may or may not appear. I have contacted Apple and they do not have a solution for this issue. This is a huge problem for me.

    No, the senders are in most case sending from corporate servers which are almost certainly not Mac based. Also, remember this happens when I send or receive. So if I send something with an attachment, the attachment will go through, but the sent box will not show the paper clip icon so that I can distinguish the emails sent with attachments versus the emails sent without attachments. I receive the attachments as well, but again the paper clip icon does not show up so that I can distinguish the emails that I have received that contain attachments. Recipients of my e-mails have complianed that when they receive an attachment from me they do not see the paper clip icon which alerts them to the fact that the email contains an attachment.

  • Sending an attachment with an e-mail

    Does anyone know how to send an attachment with an e-mail
    using a
    form page that is on our web site? I am using the TYPE
    attribute of
    the form tag as "File" to get the file I want to attach to
    the e-
    mail. Below is the code I have. The first page is where the
    user can
    click the browse button to search for a file to attach. The
    second
    page is where the e-mail should be sent to. Thanks for your
    help.
    Andy

    Ian,
    Do we have to set a folder up on our cold fusion server or do
    we just
    make a folder under our web site so when a user clicks on the
    browse
    menu, the file they attach has to be saved to our server
    first and then
    I can attach the saved file to an e-mail? How do we create
    this folder?
    Does it have to be an FTP site or just a folder on our web
    site? How do
    we make the permissions work correctly since a folder under
    our web site
    is not writable to except by the web editors that work here?
    Please let
    me know what I can do to get this to work. Thanks.
    Andy
    You can use any folder on the CF server or any system to
    which it has
    access. By default the CF service runs as a localsystem user,
    so would
    generally only have access to the local server file system.
    This is
    determined in the Services panel on window systems, I'm not
    sure how it
    works for other OS's.
    If you are talking about the "Browse" button that is
    displayed in the
    web page for the <input type="file" ..> that does not
    browse the server,
    it browses the local user's system. You do not and can not
    influence
    this in any way. When a user selects a file from their system
    and
    submits the form, the file is uploaded to the webserver
    through the HTTP
    response header or URL query string, depending on whether the
    form is a
    post or get form.
    You then use the <cffile action="upload" ...> tag on
    the form's action
    page to get the file from the web server and write it to a
    location you
    define the "file" parameter of the flag. This file system
    access is
    done under the permissions of the ColdFusion server, again
    'LocalSystem'
    by default.
    You can then use this newly saved file in you <cfmailparam
    ...> tag to
    attach it to an email. After this if you like you can use a
    <cffile
    action="delete" ...> to remove the file.

  • Getting: Unable to send attachment with Mail Drop

    Mail Drop is not working for me, I always get error message while trying to send.
    Here is what happens:
    -I compose a message that includes a large attachment
    -I click send
    -I get the message "Unable to send attachment with Mail Drop" for a few seconds
    -My message is not sent and it goes into the Outbox folder.
    Configuration:
    OS X 10.10 Yosemite
    Mail -> Preferences -> Accounts -> Advanced. The option "Send large attachments with Mail Drop" is selected.

    I had the exact same problem.  I finally figured out what was wrong.  I believe you must have iCloud Drive turned on in System Preferences AND you also must allow mail to store document in iCloud Drive which you can check by clicking the "Options..." button in the preference pane of iCloud Drive. As you can see below.

  • How to get mail to open a PPS attachment with Keynote instead of Preview in OS 10.8.5

    How do I get Keynote to open a PPS attachment in Mail using OS 10.8.5
    It now opens automatically with Preview and I want to change this to Keynote

    One more thing. I know you can do the "get info thing" and then change the "open with" however this only works when I drag the attachment to the desktop NOT in Mail.

  • Using Windows: Send to -- Mail recipient, msg is sent OK, but not saved in Sent folder, with err msg about it. Sending from within Thunderbird: msg saved OK.

    When using Windows 8.1 context menu: Send to --> Mail recipient, message is sent OK, but not saved in Sent folder, with error massage: There was an error saving the message to Sent. Retry? (selecting Retry doesn't help).
    Similar issue happens when I open a ".eml" file and Reply of Forward it.
    When composing a new message from within Thunderbird, all is OK, including saving in the Sent folder.
    Already tried:
    Compacting the Sent folder.
    Compacting all folders of the account.
    Uninstall Thunderbird and install the latest version (31.6.0).

    When using Windows 8.1 context menu: Send to --> Mail recipient, message is sent OK, but not saved in Sent folder, with error massage: There was an error saving the message to Sent. Retry? (selecting Retry doesn't help).
    Similar issue happens when I open a ".eml" file and Reply of Forward it.
    When composing a new message from within Thunderbird, all is OK, including saving in the Sent folder.
    Already tried:
    Compacting the Sent folder.
    Compacting all folders of the account.
    Uninstall Thunderbird and install the latest version (31.6.0).

Maybe you are looking for

  • How to use maximum date condition in where clause ?

    Hi I want to check if SWITCH_FLAG has 'Y' for the latest batch run..how can write it? (select a.SWITCH_FLAG from MORTGAGE where SYS_EFF_DATE = max(SYS_EFF_DATE) ) as expected_result Error message: ORA-00934: group function is not allowed here

  • How can I change the format of some of the pages of a PDF-document?

    I use Adobe Acrobat and have a PDF-document with A4 pages and some pages of another format (half of an A4). How can I change the format of these pages to A4 (with a lower blanc part)?

  • Macpro with a Samsung Syncmaster 930B... Any Problems?

    Greets, I want to buy a macpro. I will be using it with a samsung syncmaster 930b. Anyone running the macpro with a samsung lcd? any problems? Any input or information is appreciated. Ibook G4   Mac OS X (10.4.8)  

  • Restricting PO line item quantity

    HI all, How should i restrict a PO line item quantity from RFQ Quantity? please help me how to restrict PO quantity. Thanks, Message was edited by: sungnam ko Message was edited by: sungnam ko

  • Empty Aggregation Level - Need user to put in entries when none exist

    Hi, I have an aggregation level for Version, Material Family, and a Key Figure.  The Cube has no data planned at this level when the user 1st starts to work with their version.  I am trying to find a way to get the user to be able to input a Key Figu