Send email with microsoft word attachment

Hi,
I need to send the microsoft word as an attachment to external email.  When I send an email using transaction SBWP to external email, the recipient will receive the attachment in Microsoft word format.  But when I send the attachment to external email using my program,  the Microsoft word automatic change to pdf.  Kindly help.  Attach is my sample program.
*&      Form  send_email
FORM send_email .
  LOOP AT raw_tab.
    MOVE raw_tab-l TO it_attach-line.
    APPEND it_attach.
  ENDLOOP.
  WRITE 'Test' TO w_doc_data-OBJ_DESCR.
  perform get_packing.
  perform populate_email_message_body.
  perform receiver.
  lt_objhead = 'TEST'.
  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = w_doc_data
    IMPORTING
      sent_to_all                = w_sent_all
    TABLES
      packing_list               = t_packing_list
      object_header              = lt_objhead
      contents_bin               = it_attach
      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.
  COMMIT WORK AND WAIT.
ENDFORM.                    " send_email
*&      Form  get_packing
FORM get_packing .
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-body_num = t_packing_list-body_num.
  t_packing_list-doc_type = 'TXT'.
  APPEND t_packing_list.
Create attachment notification
  t_packing_list-transf_bin = space.
  t_packing_list-head_start = 1.
  t_packing_list-head_num   = 1.
  t_packing_list-body_start = 1.
  DESCRIBE TABLE it_attach LINES body_num2.
  t_packing_list-body_num = body_num2.
  t_packing_list-doc_type   =  'DOC'.
  t_packing_list-obj_descr  =  'TXT attachment'.
  t_packing_list-obj_name   =  'ATTACHMENT'.
  DOC_SIZE2 = ( ( body_num2 - 1 ) * 255 ) + STRLEN( it_message ).
  t_packing_list-doc_size   = doc_size2.
  APPEND t_packing_list.
ENDFORM.                    " get_packing
*&      Form  populate_email_message_body
form populate_email_message_body.
  REFRESH it_message.
  it_message = 'Testing program'.
  APPEND it_message.
ENDFORM.                    " populate_email_message_body
*&      Form  receiver
FORM receiver .
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  t_receivers-receiver = [email protected]'.
  APPEND t_receivers. clear t_receivers.
ENDFORM.                    " receiver

just pass mail Id and the Pc file path of word doc in the selection screen of the below program ,it will send it as word attachment to the recepient.pls reward points if helpfull -
REPORT  ZGILL_SENDMAIL_PDF                      .
INCLUDE ZGILL_INCMAIL.  "SEE BELOW FOR INCLUDE PROGRAM CODE.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case DEFAULT '[email protected]'.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY DEFAULT 'C:\TEMP\SALARY_SLIP1.PDF'.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
*********************iNCLUDE pROGRAM********************************************
*&  Include           ZGILL_INCMAIL                                    *
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = 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.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
**********************INCLUDE END********************************

Similar Messages

  • How to use UTL_SMTP to send email with existing file attachment

    Hello! I am trying to create a pl/sql procedure that lets me send an email and include an existing file to a email address. So far, I found information on how to send a file and create an attachment with information I put in the procedure. This is NOT what I'm trying to do. I'm trying to send an email and include an attachment for a file that already exists. I need the pre-existing file to be sent to the email recipient.
    This is how far I've gotten, but this only allows me to CREATE an attachment with the information I put in it from the procedure. I got it from the following site:
    http://www.orafaq.com/wiki/Send_mail_from_PL/SQL
    DECLARE
       v_From       VARCHAR2(80) := '[email protected]';
       v_Recipient  VARCHAR2(80) := '[email protected]';
       v_Subject    VARCHAR2(80) := 'Weekly Invoice Report';
       v_Mail_Host  VARCHAR2(30) := 'mail.mycompany.com';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
    BEGIN
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Data(v_Mail_Conn,
        'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
        'From: '   || v_From || crlf ||
        'Subject: '|| v_Subject || crlf ||
        'To: '     || v_Recipient || crlf ||
        'MIME-Version: 1.0'|| crlf ||     -- Use MIME mail standard
        'Content-Type: multipart/mixed;'|| crlf ||
        ' boundary="-----SECBOUND"'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/plain;'|| crlf ||
        'Content-Transfer_Encoding: 7bit'|| crlf ||
        crlf ||
        'This is a test'|| crlf ||     -- Message body
        'of the email attachment'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/plain;'|| crlf ||
        ' name="ap_inv_supplier_cc10.txt"'|| crlf ||
        'Content-Transfer_Encoding: 8bit'|| crlf ||
        'Content-Disposition: attachment;'|| crlf ||
        ' filename="ap_inv_supplier_cc10.txt"'|| crlf ||
        crlf ||
        'TXT,file,attachment'|| crlf ||     -- Content of attachment  (THIS IS MY PROBLEM!  I NEED TO BE ABLE TO ATTACH AN EXISTING FILE, NOT CREATE A NEW ONE)
        crlf ||
        '-------SECBOUND--'               -- End MIME mail
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /

    First, you must create a directory object
    create directory ORALOAD as '/home/ldcgroup/ldccbc/'
    /Study the Prerequisites in the link I posted above, or else you will not be able to read/write files from the above directory object
    "fname" relates to the file name that you read from.
    In the code below, it is also the name of the file that you are attaching.
    Although they can be different!
    l_Output is the contents of the file.
    declare
    vInHandle  utl_file.file_type;
    flen       number;
    bsize      number;
    ex         boolean;
    l_Output   raw(32767);
    fname      varchar2(30) := 'ap_inv_supplier_cc10.txt';
    vSender    varchar2(30) := '[email protected]';
    vRecip     varchar2(30) := '[email protected]';
    vSubj      varchar2(50) := 'Weekly Invoice Report';
    vAttach    varchar2(50) := 'ap_inv_supplier_cc10.txt';
    vMType     varchar2(30) := 'text/plain; charset=us-ascii';
    begin
      utl_file.fgetattr('ORALOAD', fname, ex, flen, bsize);
      vInHandle := utl_file.fopen('ORALOAD', fname, 'R');
      utl_file.get_raw (vInHandle, l_Output);
      utl_file.fclose(vInHandle);
      utl_mail.send_attach_raw(sender       => vSender
                              ,recipients   => vRecip
                              ,subject      => vsubj
                              ,attachment   => l_Output
                              ,att_inline   => false
                              ,att_filename => fname);
    end;
    /

  • FDM Send Email with a Report attachment

    Hi All,
    I'm currently trying to roll out a form of "Lights - Off " automation in for HFM version 9.3.3 , by using the FDM Task Manager to schedule loading information from my organisation's source system JDE.
    The final element of that automation from our perspective is to have an alert email from FDM to certain users once the 4 - Fish process is complete.
    This has worked successfully using 'Send Mail' from Accelerators, however what would be even more useful is to be able to either attach Process/Check Reports.
    I am only a beginner in VB but am willing to take steps if someone can point me in the right direction of either adding the report in the body of the email or as an attachment. I saw a great example of an email alert from Tony Scalese on the attached link
    http://www.fdmguru.com/enabling-lights-out-automation/
    Any help would be much appreciated.
    Cheers
    Pip

    I assume your familiar with the 'Send Mail' Accelerator script so i won't go into that part of it.
    As mentioned previously I opted to attach the source file and save reports on a shared drive. Therefore from the selected script below you can modify to your needs.
    Firstly I published a report (using the Report Publishing accelerator) to a specific location with a variable name (as shown in my example below) or you can give it a specific name so each time it's run it will overwrite the previously run report.
    Publish Report*
    Dim objReport
    Dim lngReportID
    Dim lngPublishType
    Dim strPublishPath
    'Initialize Variables
    lngReportID = 87          'Check Report +(You need to check the report properties for this number)+
    lngPublishType = 31          'PDF
    strPublishPath = "C:\Temp\Validation Report_"&API.POVMgr.PPOVLocation&"_"& API.POVMgr.PPOVCategory &"_"& API.POVMgr.PPOVPeriod &"_"& FormatDateTime(Date,1)&"_"&retv&".pdf"
    'Create the Report object
    Set objReport = CreateObject("upsWReportingDM.clsReportPublisher")
    objReport.mInitialize API
    'Publish the Report
    objReport.mReportPublishToFile CLng(lngReportID), CStr(strPublishPath), CLng(lngPublishType)
    'Destroy the objects
    Set objReport = Nothing
    To attach this to your email :
    .AddAttachment strPublishPath
    This should get you on your way, let me know if you encounter any issues. Also as a newbie I'd appreciate it if you can tag if this message was correct or helpful.
    Cheers
    Pips

  • SEND EMAIL WITH PO AND ATTACHMENT FILES

    Hi,
    I'm working with MySAP Enterprise 4.7 and I want to send the PO and its attachment vía e-mail, currently only the PO is being sent to the Vendor and the attachment only appears like texts into the "body" of PO. Is there some way to send e-mail with the PO and attachments at the same time??
    I attached the document via DMS at position level.
    Thanks in advanced for your answer and help!!
    Regards,
    Blanca Reyes

    hi
    Follow these steps
    Basically there are two mail types: Internet mail (external mail) and
    SAPOffice mail.
    Mail is sent via the output determination in both cases.
    If you use the external mail, the message for the purchasing document is
    converted into a corresponding text file which is sent to the vendor via
    the Internet.
    SAPOffice mail is sent only within the R/3 System and has mainly the
    function of providing information.
    In particular, it is not possible to attach a message (form) for a
    purchasing document to a SAPOffice mail.
    When using external mail, the following basic settings are required:
    1. You must maintain an e-mail address in the address in the vendor
    master.
    2. The same applies to your own user master. You also have to specify
    an e-mail address there in order to identify the sender.
    o Note that it is not possible to change the e-mail address of the endor
    o You can use a temporary email address in Transaction ME21N.
    3. For the output type for default values, a communication strategy
    needs to be maintained in the Customizing that supports the e-mail.
    You can find the definition of the communication strategy in the
    Customizing via the following path: (SPRO -> IMG -> SAP Web
    Application Server -> Basic Services -> Message Control -> Define
    Communication Strategy). As a default, communication strategy CS01
    is delivered. This already contains the necessary entry for the
    external communication. Bear in mind that without a suitable
    communication strategy it is not possible to communicate with a
    partner via Medium 5 (external sending).
    4. Use the standard SAP environment (program 'SAPFM06P', FORM routine
    'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.
    5. In the condition records for the output type (for example,
    Transaction MN04), use medium '5' (External send).
    6. You can use Transaction SCOT to trigger the output manually. The
    prerequisite for a correct sending is that the node is set
    correctly. This is not described here, but it must have already been
    carried out.
    7. To be able to display, for example, the e-mail in Outlook, enter PDF
    as the format in the node.
    To use the SAPOffice mail, the following basic settings are required:
    1. For the output type for default values, a communication strategy
    needs to be maintained in the Customizing that supports the e-mail.
    You can branch to the maintenance of the communication strategy via
    the input help.
    2. Use the SAP standard environment (program "RSNASTSO" and FORM
    routine "SAPOFFICE_AUFRUF") as the processing routines.
    3. In the condition records for the output type (for example,
    Transaction MN04), use medium '7' (SAPOffice) and also partner role
    'MP' (mail partner).
    Additional settings:
    Problem:
    How can you both change the mail title and text for the sending of a
    mail message and maintain a replacement parameter, for example a
    document number.
    Solution:
    1. The replacement routine is maintained in the Customizing for the
    output type in the detail screen on the 'General data' tab under
    'Replacement of text symbols' (for Release < 4.6B, this can be found
    on the 'Mail' tab page).
    Program: SAPMM06E
    FORM routine: TEXT_SYMBOL_REPLACE
    2. Maintain mail title and text.
    o If you want to send a purchase order within an R/3 system using
    the SAP office, you can maintain both the mail title ('Re:') and
    also a mail text in the Customizing for the output type To do
    this, select the directory mail title and text for the
    corresponding message type.
    o If you want to send a purchase order as (external) mail, for
    example, to a vendor, you have to maintain the mail title in the
    condition record for the output type (for example in Transaction
    MN05) on the 'Communication method' tab page. Enter the mail
    title in the 'Text for cover page' field. You cannot maintain an
    additional mail text.
    o Note that the values from the mail title are used to create the
    description for the attachment.
    3. The replacement parameters must be enclosed by &. Example: You want
    to enter the title 'PO number '. For this you have to enter
    the following in the Document Title field (Message Customizing ->
    sub-option: Mail title and texts) 'PO number &EKKO-EBELN&'
    Reward points if helpful
    regards
    chetan

  • Sending email with report as attachment

    Dear folks,
    I'm using [this |http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] package to send emails through database, and it works.
    My question is: how to attach report to email which is sent by this package?
    Any help on this would be highly appreciated.
    Regards,
    Adnan

    adnanBIH wrote:
    Dear folks,
    I'm using [this |http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] package to send emails through database, and it works.
    My question is: how to attach report to email which is sent by this package?
    Any help on this would be highly appreciated.
    Regards,
    AdnanDear Adnan. I've written a blog post on this subject. You can view it from the following link:
    http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/

  • Sending emails from Microsoft Word 2003

    I am unable to send from Word to email recipients without cutting and pastine - which is unsatisfactory. The Send facility in Word 2003 does not work

    I now use Verizon wireless rather than cable.  Do  you think the problem may be with Verizon?
    Nope. There would be no difference there.
    Do you have Outlook 2003 as well as Word 2003?
    Do you use it or Windows Mail for your email?
    Whichever it is, set that as the default. See this Microsoft page.
       Change which programs Windows uses by default
    -Jerry

  • Send EMail with *.txt as attachment.

    Hi All i have the data in the internal table and i want to send that data as attachment  for mail in  notepad format.plz send any sample program.
    the file should be in notepad format
    thanks & Regards
    vamsin

    use the below   program  and just  pass your internal table  and activate  it  ....  it will give you the attach file   of the data  in txt format  ..  see the email id  which is defualt  ... change it as  you  email id ..
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    * Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    * Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    START-OF-SELECTION.
    * Write statement to represent report output. Spool request is created
    * if write statement is executed in background. This could also be an
    * ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    PERFORM process_email.
    if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
    IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM
    FORM get_job_details.
    * Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    *  perform send_email using p_email2.
    ENDFORM.
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    * Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    *  CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    * If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    * Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'TXT'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    FORM send_file_as_email_attachment tables it_message
                                              it_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.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      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[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = '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.
    [code]FORM send_file_as_email_attachment tables it_message
                                              it_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.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      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[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = '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.
    reard  points if it us usefull ...
    gIRISH

  • Sending email with an excel attachment

    Hi,
    I have designed one workflow for PO approval .For the release code 01 i am displaying the one custom report to the approver .
    Now the requirement is after release of the code 01 i have to download this custom  report into excel format and i have to send this excel sheet to the vendor email id through workflow .
    Please can any one give me how to achieve this functionality of downloading the report and sending this to vendor in background task.
    Regards
    Pavee

    You can make use of FM
    SO_NEW_DOCUMENT_ATT_SEND_API1
    For use of this FM try to search with this FM as keyword in ABAP Forum.
    Thanks
    Arghadip

  • Trying to send email with a photo attached?

    Hi Guys thanks for all your information I have carried out your requests it is still freezing and not sending.
    I have also  followed  the instructionsin in the booklet (getting started with PE11)and it is still freezing and not sending.
    The last line is Photoshop Elements 11 say's opens the message in your default email application
    where do i find this??
    Thanks again

    Hi,
    From what I remember, Yahoo is a web based mail client. Does this mean that in Edit -> Preferences -> Sharing you have selected Adobe Email Service in the Email client box?
    When you freeze, try hovering over the organizer icon in the taskbar - are there two instances? One might be headed New Message - right click on it and select maximize. See if that then displays the message.
    Brian

  • Send Email with Lines 255Char attachment

    Is itpossible in SAP?
    I want my line to be read in the notepad and keep linebyline.
    When I use WS_DOWNLOAD =>100% what I want
    Idon'tknow how to do it by mail!
    Use the fm SO_DOCUMENT_SEND_API1 but how?

    Hi,
    I just found a quite neat way of dealing with this problem that works well... Here is some example code... Its based on the BCS_EXAMPLE_1 program but instead of messing around with the texts table as I was having issues with linefeeds I convert my extract table into a string and manually add linefeed characters. From here I convert the STRING to the XSTRING format and finally into the SOLIX_TAB format. I noticed that if you specify the attachment type as TXT you get the correct extension and it opens as desired in your text editor.
    Regards,
    Pete White
    *&      Form  email_extract
          text
         -->P_GT_FULL_DATA[]  text
         -->P_P_EMAIL  text
    FORM email_extract  USING it_gt_zartifoo TYPE ty_ta_zartifoo
                              ic_email TYPE ad_smtpadr.
      DATA: str TYPE string,
            ls_zartifoo TYPE zartifoo,
            ls_string TYPE string,
            ls_xstring type xstring.
      DATA: text_content TYPE soli_tab,
            bin_content type solix_tab.
      TRY.
        -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
        -------- create and set document -------------------------------
        create document from internal table with text
          CLEAR text_content[].
          LOOP AT it_gt_zartifoo INTO ls_zartifoo.
            ls_string = ls_zartifoo.
            CONCATENATE str ls_string cl_abap_char_utilities=>cr_lf INTO str.
          ENDLOOP.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text           = str
      MIMETYPE       = ' '
      ENCODING       =
    IMPORTING
       BUFFER         = ls_xstring
    EXCEPTIONS
       FAILED         = 1
       OTHERS         = 2.
    CALL METHOD cl_document_bcs=>xstring_to_solix
    EXPORTING
    ip_xstring = ls_xstring
    receiving
    rt_solix = bin_content.
          document = cl_document_bcs=>create_document(
                          i_type    = 'RAW'
                         i_text    = text_content
                          i_subject = 'Depositos Material Extract' ).
          CALL METHOD document->add_attachment
            EXPORTING
              i_attachment_type    = 'TXT'
              i_attachment_subject = 'ARTIFOO'
             i_att_content_text   = text_content.
              i_att_content_hex = bin_content.
        add document to send request
          CALL METHOD send_request->set_document( document ).
        --------- set sender -------------------------------------------
        note: this is necessary only if you want to set the sender
              different from actual user (SY-UNAME). Otherwise sender is
              set automatically with actual user.
          sender = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD send_request->set_sender
            EXPORTING
              i_sender = sender.
        --------- add recipient (e-mail address) -----------------------
        create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
                                            ic_email ).
        add recipient with its respective attributes to send request
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
        ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          IF sent_to_all = 'X'.
            WRITE text-003.
          ENDIF.
          COMMIT WORK.
    *                     exception handling
    * replace this very rudimentary exception handling
    * with your own one !!!
        CATCH cx_bcs INTO bcs_exception.
          WRITE: text-001.
          WRITE: text-002, bcs_exception->error_type.
          EXIT.
      ENDTRY.
    ENDFORM.                    " email_extract

  • Please help, I'm unable to send an email with a pdf attachment

    We have Windows 8 Pro on the pc, I have been trying to send a pdf document that my husband needs to his work and no matter how I try to send it (either from reader or directly from my email with the attachment it just will not send.  Can anyone please help?

    No worries.  But it is strange that you cannot even send email with a PDF attachment from Microsoft Mail.  At this point, no PDF viewers (e.g. Microsoft Reader, Adobe Reader Touch) are involved because you are not viewing PDF files.
    Instead of saying "It won't send", you need to describe exactly what you see on the screen for every step. Where does the problem start? 
    Step 1: Attaching a PDF file to new email in Microsoft Mail
    Are you able to find the PDF file and attach it to new email?
    Step 2: Sending email with a PDF attachment
    What happens when you click the Send button?  Does it hang forever?  Does it show an error message? Could you confirm that you can send email with other type of attachments (e.g. text file, Word file) from Microsoft Mail from the same PC?
    You can provide the details to Microsoft for troubleshooting.
    Alternatively, you can try to send email with the PDF attachment from other accounts like Gmail (Google Mail) or Yahoo Mail via the web browser (Internet Explorer) interface.
    Sometimes, rebooting your system solves "mysterious" problems, too.
    Good luck!

  • Sending emails with both body and attachment to multiple recipients

    I have a requirement to send email with body and attachment to multiple recipients.
    Body of the email is a standard text. It is a proxy-to-mail scenario.
    Here is what I've done: (I'm using PI 7.11)
    One mapping from Source to Target structure (format of the attachment text file)
    Second mapping from Target Structure to Mail Package format.
    In the second mapping I'm concatenating the output of first step into "Content" of the Mail Package.
    "XIPAYLOAD" is the message protocol used.
    The "Keep attachments" option in the Mail adapter allows only to send "Content" as attachment or as body of the email.
    How to send an email with both content and text?
    The other problem is even with using ASMA, I can't send email to multiple recipients. I can only do CC and TO for 1 person each - a total of 2. Although I can resolve this by creating mailing lists, it is better if this can be addressed in PI.
    Thanks for any input you can provide!
    Edited by: crazylad on Jan 18, 2012 3:39 PM

    Thank you for your response Mikael.
    For the first question, I was able to find the solution in the following blog:
    XI Mail Adapter : Dynamically building attachment and message body content using a simple UDF
    (I just needed to search with the right set of key words )
    The key is to set the "Content Encoding" as "None" in the mail adapter. If this is not done, the mail will be sent with an attachment - untitled.bin containing both the mail body and the attachment text. Also, don't forget to check the "Keep Attachments" checkbox in the mail adapter.
    Multiple recipients could be added by separating the email IDs with a Comma. I have used ASMA to set the recipients.

  • Can't send email with large (over 1MB) attachment

    Win 7 64-bit, Thunderbird 31.2.0, eSet antivirus (but disabling it for email doesn't help), godaddy email server (works fine from godaddy web mail), port 80 (been using this port for years; 25 doesn't work)
    Sending email with a 974KB attachment works. Email with a 1.4MB (and larger) attachment doesn't work. The error message appears pretty quickly (5 seconds at the most).
    The message is "the connection to SMTP server smtpout.secureserver.net timed out".
    This problem seem to appear at random, then go away and all is well (for a while).

    No. The modem is an Arris obtained from Comcast on 6/9/2014 after the prior one failed.

  • Emails with MS word attachments not arriving, but Pages attachments okay

    When I send an email with a Word attachment that was originally created in MS Word (v 11.3.5), the email does not arrive at its destination. I've started bcc'g myself to doublecheck and it seems consistent, no matter where it is going. It shows up as "Sent" in the mailbox, but the recipient never receives it.
    However, when I create the document in Pages, then convert it to a Word document using "Export" in Pages, then attach it to an email, the email goes through without a problem.
    Just now, I created the document in Pages, converted it using "Export", then edited it a bit while it was in Word. When I sent the email as an attachment, it disappeared again and did not arrive at its destination. This is really scary, because I have frequently sent people emails and assume that they are arriving (the email shows up in my "Sent" mailbox, but just disappears into cyberspace somewhere.)
    Is this a glitch with Word or Mail? It started happening about 4 months ago, and I have already tried re-installing Word. That seemed to fix it for awhile but it's just happened again.
    Any suggestions? Thanks.

    John H wrote:
    The command tells me I have 0 message size limit
    The limit in the admin server is set to 1000MB
    For gigabyte-class file transfers, you'll really want to use a different path — that message size is easily approaching a denial-of-service scale message size, if not exceeded it.
    If you really want to try doing attachments of that size and all the intervening SMTP servers support it, then try setting the message size manually via something like the (untested) following commands:
    sudo postconf -c /Library/Server/Mail/Config/postfix  message_size_limit  -e  "message_size_limit = 10485760"
    sudo postfix reload
    Or to whatever specific attachment size you want to try to use.  The unit is in bytes.
    The other Postfix setting that tends to get involved here is mailbox_size_limit, as well as whatever quotes might be in use for the specific users.

  • Sending email with multiple attachments

    Hi forum,
    I am able to send email with a single attachment using maildemo.sql from: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    But now I am trying to send email with more than 1 attachment and it does not work. My code that calls the above mentioned package is as follows:
    <code>
    PROCEDURE send (
    psender VARCHAR2,
    precipients VARCHAR2,
    pcc VARCHAR2,
    pbcc VARCHAR2,
    psubject VARCHAR2,
    pmessage VARCHAR2,
    pnumattach NUMBER) -- The number of attachments that need to be sent
    IS
    p_blob BLOB;
    p_filename VARCHAR2(200);
    p_filetype VARCHAR2(200);
    p_currSeq NUMBER;
    conn utl_smtp.CONNECTION;
    i NUMBER;
    j NUMBER;
    len NUMBER;
    BEGIN
    IF pnumattach > 1
    THEN
    conn := SEND_EMAIL_HELPER.begin_mail(
              sender => psender,
              recipients => precipients,
              subject => psubject,
              mime_type => send_email_helper.MULTIPART_MIME_TYPE);
    j := 0;
    SELECT seq_attach_transact_id.CURRVAL INTO p_currSeq FROM dual; -- seq_attach_transact_id is a primary key that identifies every single attachment in the table
    WHILE (j < pnumattach) LOOP
    p_currSeq := p_currSeq - j;
    SELECT blob_content INTO p_blob FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SELECT name INTO p_filename FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SELECT mime_type INTO p_filetype FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SEND_EMAIL_HELPER.begin_attachment(
    conn => conn,
    mime_type => p_filetype,
    inline => TRUE,
    filename => p_filename,
    transfer_enc => 'base64');
    -- split the Base64 encoded attachment into multiple lines
    i := 1;
    len := DBMS_LOB.getLength(p_blob);
    WHILE (i < len) LOOP
    IF(i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH < len)THEN
    UTL_SMTP.Write_Raw_Data (conn,
    UTL_ENCODE.Base64_Encode(
    DBMS_LOB.SUBSTR(p_blob, SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH, i)));
    ELSE
    UTL_SMTP.Write_Raw_Data (conn,
    UTL_ENCODE.Base64_Encode(
    DBMS_LOB.SUBSTR(p_blob, (len - i)+1, i)));
    END IF;
    UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
    i := i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH;
    END LOOP;
    SEND_EMAIL_HELPER.end_attachment(conn => conn);
    END LOOP;
    SEND_EMAIL_HELPER.attach_text(
    conn => conn,
    data => pmessage,
    mime_type => 'text/html');
    SEND_EMAIL_HELPER.end_mail( conn => conn );
    ELSE
    utl_mail.send(psender,precipients,pcc,pbcc,psubject,pmessage);
    END IF;
    END send;
    </code>
    Can anyone please tell me where am i going wrong.
    Message was edited by:
    Monk

    The easiest is to send an e-mail with multiple attachments to yourself and then view the message in raw to see how it is formatted - how the boundaries work. what the boundary headers are, etc.
    Then you use that as a template for your PL/SQL code to generate a MIME body for an e-mail that has multiple attachments.
    To debug.. have your PL/SQL code send sample e-mails with multiple attachment to your account, view it in raw format and compare that to the original format you've based your template on.
    And none of this is really a PL/SQL issue.. it is all about formatting a valid MIME message for an e-mail.

Maybe you are looking for

  • BDLS failed in new system

    Hi all, We are experiencing an error when runing BDLS in SAP BW 7.0. To give you an overview, I am working on a new production system called BWP (copy of an acceptance system). Attached to this new BW system, we have a new source system called BRP. I

  • PLEASE URGENT HELP!!!!!

    hey, excuse me by my english....i ned to know why when i send my new iweb page to my clients, some window apear and ask to every body by my name and password.... I don't want to give my password to every vary!!!!!!!

  • Error 49 on Laserjet M1522nf

    The printer copies and prints ok but when I press  the Start Fax button I get the Error 49 message, I updated the firmware but the issue still there. I'm told the formatter board has more than likely failed and it's out of warranty so I have to pay t

  • Inventory management @ project site

    Dear Friends We are doing customer project. Most of my client's project are Turn key projects, which usually run for 2-3 years. In the span of project life, lots of materials at different stages will be procured & will be dispatched to project site f

  • Workspace - repeat the column names in all pages.

    Hi, I ve got a report in FR. When i open the report in PDF format in workspace how can i repeat the column headers(column names) in all pages. The column Names are in a text row. Thanx in advance Anuradha