Problem in sending email with attachment more than 32kb through utl_mail

Hi friends
I am able to send an email with attachment upto 32kb using utl_mail.
But whenever I increase the size of attachment from 32kb, it prompts me an error.
===============================================
ORA-20001: The following error has occured:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
===============================================
i have also used LONG RAW instead of RAW, bu still the problem is same.
please help me in solving this issue.
Thanks in advance,
Ankur

Yeah that's an issue with UTL_MAIL it only has 3 procedures, and none of them let you send data to the SMTP server incrementally. To send files larger than 32k you will need to switch over to using UTL_SMTP directly or via a helper package such as the [DEMO_MAIL package|http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] available from otn.

Similar Messages

  • Problem of sending email with attachment by SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi experts,
    When I sent email with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' with TXT attachment, I found the there were no new line after each row of the content of TXT file attachment . All the rows in the internal table are concatenated into a string without any new line mark. It damaged the format of my attachment.

    You need to concatenate your text with  l_c_cr_lf  (For enter button or new line) after every 255 char to get new line. Below is the code.  Let me know in case of ny clarifications.
    CONSTANTS:  l_c_cr_lf    TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf,
                  l_c_255 TYPE char3 VALUE '255'.
    DATA: l_v_cr_lf TYPE abap_cr_lf,
            l_v_n TYPE i,
            l_v_dif TYPE i,
            l_v_strlen TYPE i.
    l_v_cr_lf = l_c_cr_lf.
      l_v_n = 0.
      LOOP AT fp_i_mail_out INTO wa_mail_out.
        l_v_strlen = STRLEN( wa_mail_out ).
        CLEAR l_v_n.
        DO.
          l_v_dif = l_v_strlen - l_v_n.
          IF l_v_dif < l_c_255.
            EXIT.
          ELSE.
            l_wa_attachment =  wa_mail_out+l_v_n(255).
            APPEND l_wa_attachment TO l_i_attachment.
            CLEAR l_wa_attachment.
            l_v_n = l_v_n + 255.
          ENDIF.
        ENDDO.
        IF l_v_strlen > l_v_n.
          l_v_dif = l_v_strlen - l_v_n.
          l_wa_attachment =  wa_mail_out+l_v_n(l_v_dif).
          APPEND l_wa_attachment TO l_i_attachment.
          CLEAR l_wa_attachment.
        ENDIF.
        DESCRIBE TABLE l_i_attachment LINES l_v_lines.
        LOOP AT l_i_attachment ASSIGNING <l_fs_attach>.
          IF sy-tabix = l_v_lines.
            CONCATENATE <l_fs_attach>-line l_v_cr_lf  INTO <l_fs_attach>-line.
          ENDIF.
        ENDLOOP.
      ENDLOOP.

  • Send an attachment in email with length more than 255 char per line

    Hi All,
    I have to send an attachment in email with length more than 255 char per line. I dont want to break the line after 255 char and add it in another line.
    Please suggest me any function module which can perform this.
    Thank you all.

    I looked at all threads in the forum, there was about 5 or 6 identical questions, but surprise, nobody knows! It seems that SO_NEW_DOCUMENT_ATT_SEND_API1 function module does not allow more than 255 characters by line.
    It would surprise me a lot if there is no workaround !
    As it is very easy to add any binary attachment which is like a very long line, PDF for example (several kilobytes), via the function module above (lots of examples in the forum), I would advise you to try to use the same way, i.e. use the contents_bin parameter instead of the contents_txt parameter (convert the text into binary) and add the line feeds yourself (okay I know, it's not very smart).
    Last thing, this function module is deprecated, and we should use BCS classes, maybe they work better.

  • How can i send an email with subject more than 50 char.

    Hi
    Can you please explain How can i send an email with subject more than 50 char?? I am using Cl_BCS=>SET_MESSAGE_SUBJECT but it is throwing an error " An exception of the type CX_SY_REF_IS_INITIAL has occured which is not caught" .
    Regards
    Alok

    Try using the following FM
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = i_mail_data
            put_in_outbox              = c_x
          TABLES
            packing_list               = i_objpack[]
            object_header              = i_objhead[]
            contents_bin               = i_objbin[]
            contents_txt               = i_objtxt[]
            receivers                  = i_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.
    Regards
    Avinash
    Edited by: Avinash Jagtap on Dec 2, 2009 7:00 AM
    Edited by: Avinash Jagtap on Dec 2, 2009 7:02 AM

  • Send Email with Attachment Callable Object

    Hello,
    I have a GP Application where i have 2 steps....in the first action the initiator attaches a document through standard GP functionality......i want to send this attachment to the approver alongwith the email i am already sending using 'Send email with Attachment (optional)' callable obejct.....how can i implement this....?
    Any help would be highly appreciated.
    Regards,
    Anil

    Hello Anil!
    Well, if i really undestand your question, i think you resolve it using callable object mail with attachment, you said that do it, so, you only need to configure your smtp on youser server and you don´t need more work.
    Please write any doubts.

  • Send Email with attachment further .

    Hello All,
          Thank Raja Thangamani for giving me an answer about <b>Send Email with attachment</b>  . But now I have a new question that when I sene Email with attachment beyond 500M , this funtion is not applied .
          Pls give me some advice! Thanks very much!

    Look at this link & thread..
    http://www.thespot4sap.com/Articles/SAP_Mail_UNIX_Example_ABAP.asp
    Send PDF Attachment to SAP Mail Inbox.
    Hope this will solve your problem.
    Raja T
    Message was edited by:
            Raja Thangamani

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

  • Sharepoint Online - Send email with attachment

    Hi All,
    is there some way how to send email with attachment, which is attached to list item in host web?
    I tried some of solutions but none of them not working.
    Server side:
    For example event receiver after added list item with attachment - Because it is office 365, in SandBox solution I can´t use SmtpClient class.
    Any other ideas?
    Client side:
    For example client web part with REST call. It works fine until I don´t need access to attachment.
    string oDataUrlAttach = "/_api/Web/lists/getbytitle('ListName')/Items(6)/AttachmentFiles('Document.docx')/$value";
                HttpWebRequest itemRequestAttach = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + oDataUrlAttach);
                itemRequest.Method = "GET";
                itemRequest.Accept = "application/atom+xml";
                itemRequest.ContentType = "application/atom+xml;type=entry";
                itemRequest.Headers.Add("Authorization", "Bearer " + accessToken);
                HttpWebResponse itemResponseAttach = (HttpWebResponse)itemRequestAttach.GetResponse();
    Here I get error: The remote server returned an error: (403) Forbidden.
    But other calls are OK. I can get all items from my list except attachments.
    Any ideas?
    Thank you.

    Why hasn't this been answered?
    Sam Ogle

  • How i can send email with attachment ?

    any body can help me ..............??????????????????

    Hello,
    please, use "Search" utility in the forum before ask something like this...
    I've just tried with :
    "send email with attachment"
    and ... you have the solution in the first result...
    Regards,
    Jose.

  • Sending email with attachment from iCloud

    when i am sending email with attachment, when i am sending email with attachment I found that the mail was send and still on draft on the client software on my mac book pro. Any solution please??

    That happens at times.  Don't know why.  Just delete the email in the drafts folder, as long as you are sure it was sent (check the sent folder).  I've wondered whether it's a timing issue.

  • BPEL send email with attachment

    Hi guys,,
    Now i want to send email with attachment from the bpel console. In bpel console, if i want to use, "browse" button, how can i create this button in my xsd file?

    Hello,
    Well I'm using the BPEL build in decoder. It works for txt file but how about PDF? Will it be the same?
    it give me this message in the email process.
    XML Parsing Error: reference to invalid character number
    p/s: it working to txt but not pdf.
    below is the script
    <bpelx:exec name="decoder" language="java" version="1.5">
    <![CDATA[String inputString = new String();
                inputString =(String)getVariableData("attachmentContentVar");  
        try {
                String decoded = Base64Decoder.decode(inputString);  
                setVariableData("decoded",decoded); 
    catch(Exception e)
    e.printStackTrace();
    }]]>
    </bpelx:exec>
    <copy>
    <from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
    part="WfattachmentCollection"
    query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:encoding"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType"/>
    </copy>
    <copy>
    <from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
    part="WfattachmentCollection"
    query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:name"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName"/>
    </copy>
    <copy>
    <from expression="bpws:getVariableData('decoded')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody"/>
    </copy>
    </assign>
    Edited by: kpchong on Oct 20, 2009 12:00 AM

  • Send Email with Attachment in BSP?

    Hello,
         I have trouble about sending Email in BSP .
         I don't know how to <b>Send Email with attachment in BSP</b> . Please give me some advice .
        Thank you very much!

    Here is a sample application..
    <b>Layout</b>
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page title="Send Mail with Attachment " >
        <htmlb:form id           = "form1"
                    encodingType = "multipart/form-data" >
          <htmlb:label for  = "MAILTO"
                       text = "Mail to" />
          <htmlb:inputField id    = "MAILTO"
                            size  = "20"
                            value = "<%= mail_to %>"
                            type  = "string" />
          <htmlb:fileUpload id          = "myUpload"
                            onUpload    = "HandleUpload"
                            upload_text = "Attach"
                            size        = "90" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    <b>Page attributes:</b>
    mail_to     TYPE     ADR6-SMTP_ADDR     E-Mail Address
    <b> Event handler OnInputprocessing..</b>
    DATA: fileUpload TYPE REF TO CL_HTMLB_FILEUPLOAD,
          file_content TYPE XSTRING,
          file_length TYPE STRING,
          file_mime_type TYPE STRING,
          file_name TYPE STRING.
    fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
                           request = request
                           id      = 'myUpload'
                           name    = 'fileUpload' ).
    if fileUpload is not INITIAL.
      file_name      = fileUpload->file_name.
      file_mime_type = fileUpload->file_content_type.
      file_length    = fileUpload->file_length.
      file_content   = fileUpload->file_content.
      mail_to = request->get_form_field( `MAILTO` ).
    * Send mail part..
      CLASS cl_bcs DEFINITION LOAD.
      DATA:
            lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
      lo_send_request = cl_bcs=>create_persistent( ).
    * Message body and subject
      DATA:
            lt_message_body TYPE bcsy_text VALUE IS INITIAL,
            lt_att_content_hex type solix_tab,
            lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
      APPEND 'Dear Vendor,' TO lt_message_body.
      append ' ' to lt_message_body.
      APPEND 'Please find the attached report.'
      TO lt_message_body.
      append ' ' to lt_message_body.
      APPEND 'Thank You,' TO lt_message_body.
      lo_document = cl_document_bcs=>create_document(
      i_type = 'RAW'
      i_text = lt_message_body
      i_subject = 'Visit report' ).
      data: data_tab type solix_tab,
      p_data type XSTRING.
    * Pass the data of the document we have uploaded..
      p_data = file_content.
      call function 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          buffer     = p_data
        TABLES
          binary_tab = data_tab.
      DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
      TRY.
          lo_document->add_attachment(
          EXPORTING
          i_attachment_type = 'PDF'
          i_attachment_subject = 'Visit Report'
          i_att_content_hex = data_tab ).
        CATCH cx_document_bcs INTO lx_document_bcs.
      ENDTRY.
    * Add attachment
    * Pass the document to send request
      lo_send_request->set_document( lo_document ).
    * Create sender
      DATA:
      lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
      l_send type ADR6-SMTP_ADDR value '[email protected]'.
    * Set sender
      l_send = mail_to.
      lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
      lo_send_request->set_sender(
      EXPORTING
      i_sender = lo_sender ).
    * Create recipient
      DATA:
      lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
      lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
    ** Set recipient
      lo_send_request->add_recipient(
      EXPORTING
      i_recipient = lo_recipient
      i_express = 'X' ).
      lo_send_request->add_recipient(
      EXPORTING
      i_recipient = lo_recipient
      i_express = 'X' ).
    * Send email
      DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
      lo_send_request->send(
      EXPORTING
      i_with_error_screen = 'X'
      RECEIVING
      result = lv_sent_to_all ).
      COMMIT WORK.
    endif.
    Hope this will be helpful.
    Raja T

  • Problem sending email with attachment by android

    Good Morning, I'm Luca.
    I have this problem:
    through a smartphone with Android system,
    synchronized via ActiveSync, the user
    is unable to send emails with attachments.
    While you can receive them and
    open them without problem.
    We have a server with Exchange 2010.
    Is there any authorization that I have to give
    you?
    Other devices, always with Android system,
    with other accounts of course,
    does not have the same problem.
    Thank you very much
    Best regards

    Luca, if one user is able to send attachments, the other should be able to as well.  However, if an attachment is too large, it won't be delivered.  
    Agreed, This does sound like a size limitation issue.
    Have the person try to send the same file from his outlook on his PC and see if he can send it out, that should be a good indication.

  • Sending mail with excel  more than 255 character in a line

    Dears,
    In my program , I use SO_NEW_DOCUMENT_ATT_SEND_API1  to send email with EXCEL attacment.
    But when i want output a line more than 255 characters  in the excel I met the problem, it only appeared 255 characters
    describe table mailbin lines tab_lines.
        mailpack-transf_bin = c_checked.
        mailpack-head_start = 1.
        mailpack-head_num = 1.
        mailpack-body_start = 1.
        mailpack-body_num = tab_lines.
        mailpack-doc_type = c_xls.
        mailpack-obj_name = space.
        mailpack-obj_descr = lv_mail_title. "the excel file name
        mailpack-doc_size = tab_lines * 255.
        append mailpack.
    * Sending the document
          call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            exporting
              document_data              = maildata
              put_in_outbox              = space
              commit_work                = c_checked
            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.
    But i have to output those characters in one line.
    Anyone could help me?
    Thanks a lot.
    Sincerely,
    Julie

    data: objpack    like sopcklsti1 occurs 2 with header line.
    data: objhead    like solisti1 occurs 1 with header line.
    data: objbin     like solisti1 occurs 10 with header line,
            is_objbin  type  solisti1 .
    data: objtxt     like solisti1 occurs 10 with header line,
            is_objtxt  type solisti1 .
      data: l_tab(1)   type c value cl_abap_char_utilities=>horizontal_tab,
           con_cret   type c value cl_abap_char_utilities=>cr_lf.
    data: tab_lines  like sy-tabix,
            : tab_lines1 like sy-tabix.
      data : lenth_string type string,
            s_string     type string.
    data : L type i, i type i,cplen type i, balance type i,
    before describe table mailbin lines tab_lines ... Use below logic.
    Loop at your_internaltable.
    concatenate field_1
                field_2
                field_3
           into lenth_string separated by l_tab.
    concatenate  lenth_string con_cret into lenth_string.  
    concatenate s_string lenth_string into s_string.
    endloop.
           L = strlen( s_string ).
           i = 0.
           cplen = 255.
           balance = l.
        do.
          if balance <= 0.
            exit.
          endif.
          if balance < 255.
            cplen = balance.
          else.
            cplen = 255.
          endif.
          objbin = s_string+i(cplen).
          i = i + cplen.
          balance = balance - cplen.
          append objbin.
        enddo. 
    ...... after this use ur exesting code....describe table mailbin lines tab_lines and so
        describe table objbin lines tab_lines1.
        clear objpack-transf_bin.
        objpack-transf_bin = ' '.
        objpack-head_start = 1.
        objpack-head_num = 1.
        objpack-body_start = 1.
        objpack-body_num = tab_lines1.
        objpack-obj_langu = 'E'.
        objpack-doc_type = 'XLS'.
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        exporting
    -tables
          packing_list               = objpack
          object_header              = objhead
          contents_bin               = objbin
          receivers                  = reclist
    Regards,
    Sri.
    Edited by: sridhar arjunan on Jul 28, 2009 4:22 PM
    Edited by: sridhar arjunan on Jul 28, 2009 4:23 PM

  • Can't send emails with pictures bigger than 8mb on iphone 4s

    Hi , I can not send email with pictures attached (3 or 4 pictures) higher than 8MB. I have an Iphone 4S

    Pictures usually size is 2 or 2.2MB each, when i try to send 4 at the same time the phone takes about 10 minutes or more to send it and finally a message in the sent folder shows "Can not send email" and thats it, if I reduce the size of the pictures sending again to ~5MB the email goes ok.

Maybe you are looking for