Hw to write text in mail body in UTL SMTP in oracle

hi all
i m using oracle demo mail package to send csv file as attachment to different users its successfull and i can also able to attach text file to it
but i m unable to write any text in mail body .
e.g.
mail body can be--
hi
This is test mail.
Regds
Sender.
can anyone suggest some way?

u can try this code
this code takes the file from database and attach with mail and also send the body with it
it works fine.
CREATE OR REPLACE
procedure pdf_mail(
p_sender varchar2, -- sender, example: 'Me '
p_recipients varchar2, -- recipients, example: 'Someone '
p_subject varchar2, -- subject
p_text long, -- text
p_case_id number,
p_email_log_id number
-- p_filename varchar2, -- name of pdf file
p_blob   blob     pdf file
) is
conn utl_smtp.connection;
i number;
len number;
p_message_part varchar2(32767);
cursor c1 is
select file_name,document_pic
from clm_case_attachments ca,email_log_detail em
where
case_id = p_case_id
and ca.CASE_ATTACHMENT_ID = em.ATTACHMENT_ID
and em.ACTIVE = 'Y'
and em.EMAIL_LOG_ID = p_email_log_id;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/html');
for lp in c1 loop
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => lp.file_name,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(lp.document_pic);
WHILE (i < len) LOOP
IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(lp.document_pic, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(lp.document_pic, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
demo_mail.end_attachment(conn => conn);
end loop;
demo_mail.end_mail( conn => conn );
END;
/

Similar Messages

  • Hw to write txt in mail body using UTL mail when sending mail with attachme

    hi all
    i m using oracle demo mail package to send csv file as attachment to different users its successfull and i can also able to attach text file to it
    but i m unable to write any text in mail body .
    e.g.
    mail body can be--
    hi
    This is test mail.
    Regds
    Sender.
    can anyone suggest some way?

    u can try this code
    this code takes the file from database and attach with mail and also send the body with it
    it works fine.
    CREATE OR REPLACE
    procedure pdf_mail(
    p_sender varchar2, -- sender, example: 'Me '
    p_recipients varchar2, -- recipients, example: 'Someone '
    p_subject varchar2, -- subject
    p_text long, -- text
    p_case_id number,
    p_email_log_id number
    -- p_filename varchar2, -- name of pdf file
    p_blob   blob     pdf file
    ) is
    conn utl_smtp.connection;
    i number;
    len number;
    p_message_part varchar2(32767);
    cursor c1 is
    select file_name,document_pic
    from clm_case_attachments ca,email_log_detail em
    where
    case_id = p_case_id
    and ca.CASE_ATTACHMENT_ID = em.ATTACHMENT_ID
    and em.ACTIVE = 'Y'
    and em.EMAIL_LOG_ID = p_email_log_id;
    BEGIN
    conn := demo_mail.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => demo_mail.MULTIPART_MIME_TYPE);
    demo_mail.attach_text(
    conn => conn,
    data => p_text,
    mime_type => 'text/html');
    for lp in c1 loop
    demo_mail.begin_attachment(
    conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE,
    filename => lp.file_name,
    transfer_enc => 'base64');
    -- split the Base64 encoded attachment into multiple lines
    i := 1;
    len := DBMS_LOB.getLength(lp.document_pic);
    WHILE (i < len) LOOP
    IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
    UTL_SMTP.Write_Raw_Data (conn
    , UTL_ENCODE.Base64_Encode(
    DBMS_LOB.Substr(lp.document_pic, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
    ELSE
    UTL_SMTP.Write_Raw_Data (conn
    , UTL_ENCODE.Base64_Encode(
    DBMS_LOB.Substr(lp.document_pic, (len - i)+1, i)));
    END IF;
    UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
    i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
    END LOOP;
    demo_mail.end_attachment(conn => conn);
    end loop;
    demo_mail.end_mail( conn => conn );
    END;
    /

  • Want to add text to mail body of  BACS Remittance Advice

    Hi Experts,
    Blelow is the requirement.
    User is sending the remittance advice to vendors, user wants to include a u2018fixedu2019 text also in that mail.
    User is sending remittance advice to vendor in PDF format which is attached in a mail, I need to add some text to mail body.
    But not able to find how mail body is filled up.
    Main program RFFOGB_T u2013 Payment program
    Includes RFFORI06 u2013 Remittance advice
    Can you please suggest how I will be able to add the text to the mail ?
    Regards,
    Subhashree.

    Hi E_Hinojosa ,
    Its helped a lot.
    But one doubt,what is process exit and how to search the same from a program or include.
    The required code(which is there in note) is there in include 06 but which process exit I will use for the BACS remittance and how to fill the value of finaa-mail_body_text in process exit.
    Please give me a clear idea.
    Thanks,
    Subhashree.

  • Send mail using cl_bcs. need text in mail body

    Hi friends,
    please provide me some solution to send mail with out attachment and the message should only be in mail body.
    Code :
    TRY.
    *     -------- create persistent send request ------------------------
            send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document -------------------------------
    *     create document from internal table with text
            CLEAR lv_const.
            CONCATENATE 'Dear' gs_cust-name1 ',' INTO lv_const SEPARATED BY space.
            APPEND lv_const TO text.
            CLEAR lv_const.
            CONCATENATE 'at' gs_cust-new_date 'planned delivery for you with following items:'
                        INTO lv_const SEPARATED BY space.
            APPEND lv_const TO text.
            l_space = '                                       ' .
            APPEND l_space TO text .
            CLEAR : gs_mat,
                    lv_const.
            CLEAR l_quan.
            LOOP AT gt_mat INTO gs_mat WHERE new_date = gs_cust-new_date.
              l_quan = gs_mat-zmeng.
              CONCATENATE gs_mat-matnr gs_mat-maktx l_quan INTO lv_const SEPARATED BY space.
              APPEND lv_const TO text.
              CLEAR :
                      lv_const.
            ENDLOOP.
            l_space = '                                       ' .
            APPEND l_space TO text .
            APPEND 'Please contact with us if you confirm whether above products are' TO text.
            CLEAR lv_const.
            CONCATENATE 'required on' gs_cust-new_date 'with specified quantity.'
                        INTO lv_const SEPARATED BY space .
            APPEND lv_const TO text.
            APPEND 'You can contact with us via e-mail:xxxxxx or via' TO text.
            APPEND 'phone +xxxxxxxxxxxxxx' TO text.
            l_space = '                                       ' .
            APPEND l_space TO text .
            APPEND 'Best regards' TO text.
            APPEND 'Linde Central Logistic Team' TO text.
            lo_document = cl_document_bcs=>create_document(
                            i_type    = 'RAW'
                            i_text    = text
    *                        i_length  = '12'
                            i_subject = 'test mail' ).
    *     add document to send request
            CALL METHOD send_request->set_document( lo_document ).
    *     --------- add recipient (e-mail address) -----------------------
    *     create recipient - please replace e-mail address !!!
            recipient = cl_cam_address_bcs=>create_internet_address(
                                              'address' ).
    *     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 ).
              COMMIT WORK.
    *  Send Immediately
              send_request->set_send_immediately( i_send_immediately = 'X' ).
          CATCH cx_bcs INTO bcs_exception.
            WRITE: text-001.
            WRITE: text-002, bcs_exception->error_type.
            EXIT.
        ENDTRY.
    Please provide me the solution if i am missing any thing.
    Thanks,
    Kat

    thank you for looking into this thread,
    i have configured the in scot.
    currently sending all RAW type as TXT. this has resolved my issues.

  • Add text in mail for payment notification RFFOAVIS_FPAYM

    Hi All,
    We are sending payment notification to vendors via RFF0AVIS_FPAYM program. We are using SAP script form for this.
    We want to add text in mail body. I have checked note 1033893. I have created text with name z* in SO10 and assigned in process exit for 00002040. But text is not appearing in mail.
    Am i missing some settings ?
    Please give suggestions.
    Thanks in advance.
    Regards,
    Chintan

    Hello,
    Point 1
    Please check up the function module attached to proces 00002040 in FIBF.
    Make the changes in the function module.
    Please refer:
    SAP NOTE 1033893, 836169.
    Also see Note 521587.
    Regards,
    Ravi

  • Mail Notification with Custom Subject, Mail Body and PDF File Name

    I have successful configured the Action Profile to send SmartForm Mail as PDF. But i would like to modify the Subject, PDF File Name & add text to mail body when a mail is sent to the user.
    The Subject of the Mail is the same as the PDF file name. How to maintain a pre-defined file name for the PDF file.

    I was able to find a commercial product that works very well. MaxBulk Mailer from Max Programming allows you to import a list of recipients, merge with personalized message and designate an attachment (just image types and PDFs, not all types work) and send.

  • FSCM correspondance mail has to be configured to have mail body

    Hi Experts,
    We have configured correspondace in FSCM to send out mail/FAX/print smartforms. Now, these smart-forms when sent as e-mail, go as attachment to mail. We have a requirement wherein we want to add some text in mail body.
    After debug we found that internally it is calling FM SO_OBJECT_SEND to send mail but, not passing any tables parameters to it.
    Request you to please provide us some pointers in case you have already worked on this. Also, let us know some workarounds in case you are aware/think of.
    Any input will be highly appreciable.
    Thanks,
    Gouri.

    Odgenite,
    Please first complete your profile, if you don't know how please click Profile Update for instructions.
    The first thing to do is restart in Recovery Mode, open Disk Utility and run Repair Permissions 2x. If you don't know how to start in Recovery Mode then hold down the Option key when you hear the startup tone and you will see what partitions to start from. Choose Recovery, then open Disk Utility. After running Repair Permissions 2x restart normally and re test. If this does not work then open in Recovery Mode again this time reinstall OS X, this will leave your data alone however it is ALWAYS wise to backup your data prior to doing any update or upgrade.

  • Mail body

    Hallo
    I am using method create_from_text. I want that the mailbody filled with the text in table i_tab.
    But it creates txt file in attachtement. In this file appears my mailbody text.
    can some body tell me my mistake. what should I do that i_tab text in mail body appears.
    here is my code
    TRY.
          CALL METHOD cl_document_bcs=>create_from_text
            EXPORTING
              i_text         = i_tab
              i_documenttype = 'RAW'
              i_subject      = l_btr
              i_importance   = '0'
              i_sensitivity  = 'P'
            RECEIVING
              result         = l_result.
        CATCH cx_document_bcs .
      ENDTRY.
    regards
    rana
    Moderator message - Cross post locked
    Edited by: Rob Burbank on Sep 1, 2009 9:26 AM

    "This might help you
    DATA:list_object TYPE TABLE OF abaplist.
    DATA:listasci(128) TYPE c OCCURS 0.
    DATA:   BEGIN OF int_tline1 OCCURS 100.
            INCLUDE STRUCTURE tline.
    DATA:   END OF int_tline1.
    DATA:it_text TYPE soli_tab.
    DATA: wa_text LIKE LINE OF it_text.
    DATA:wa_ascii LIKE LINE OF listasci.
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sent_to_all        TYPE os_boolean.
    SUBMIT yprogram2 EXPORTING LIST TO MEMORY AND RETURN.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = list_object.
    CALL FUNCTION 'LIST_TO_ASCI'
      TABLES
        listasci           = listasci
        listobject         = list_object
      EXCEPTIONS
        empty_list         = 1
        list_index_invalid = 2
        OTHERS             = 3.
    LOOP AT listasci INTO wa_ascii.
      wa_text-line = wa_ascii.
      APPEND  wa_text-line TO it_text.
    ENDLOOP.
    TRY.
      send_request = cl_bcs=>create_persistent( ).
      document = cl_document_bcs=>create_document(
                                i_type = 'RAW'
                                i_text = it_text        "<-----mail content
                                i_subject = 'Test mail' ).
      send_request->set_document( document ).
      recipient  = cl_cam_address_bcs=>create_internet_address( )."Include email inside the brackets
      send_request->add_recipient( i_recipient = recipient ).
      send_request->set_send_immediately( 'X' ).
      send_request->send( EXPORTING i_with_error_screen = 'X' ).
      COMMIT WORK.
    ENDTRY.

  • IPad e-mail won't send if text included in body

    I am unable to send e-mail from my iPad if I write any text in the body of the e-mail.  If I only have text in the 'Subject' line, it works fine and will send.  I have checked all the e-mail settings and they are correct. 

    JUST DOUBLE CHECKED ALL OF THIS....DO NOT EXPERIENCE YOUR PROB.
    Tom
    Freedom Essentials, QIP 7100 1,Bose SOLO TV Sound System,,QIP 7216 P2,M1424WR Rev F, iPad 2 WiFi,iPhone 5,TV SYST INFO Release 1.9.5 Build No. 17.45
    Data Object 39.45
    Attachments:
    iPad 2 and iPhone Email settings 3 2 2014.pdf ‏72 KB

  • How Do highlight text in the body of an email message in Mac Mail?

    Can anyone tell if IF and HOW I can highlight text in the body of an email message using Mac Mail (in Yosemite).  I do NOT mean MARKUP an attachment.  I want to highlight a word or phrase in the body of my email message.  I know I can change the font color, but can't seem to add a highlight!  Thanks!

    Hi,
    is is possible, - link is below. Works on Yosemite, btw.
    http://www.mihalick.us/how-to-highlight-text-in-yellow-using-apple-mail/

  • How is the e-mail body text determined when e-mail sent from PO in edit mod

    We have an e-mail that is sent to the supplier when the buyer edits the po then goes to header-output - create and send immediately.   We want to remove the SAP default Salutation
    Best Regards,
    Your Purchasing Company
    The problem is we cannot find where this e-mail body is being created.   Any ideas?
    Sandra

    Hello,
    The email body text that you get at SOST is from the cover form BBP_OUTPUT_COVER.
    When you Order a PO, the following is the text is seen in SOST.
    "&LV_TITLE&
    Please find enclosed the purchase order &IV_PO_HEADER-OBJECT_ID& &IV_PO_
    Kind regards,
    Your purchasing company"
    You can create your own cover form in order to substitute the standard BBP_OUTPUT_COVER.
    Regards,
    Ricardo

  • Default text in the body of mail when sent to vendor thru PO

    Dear friends,
    We need to put in the email body a message to vendor.
    We wrote in the tcode NACE a message in the text field and the email was generated , but without the text body !
    The attachment has been generated correctly. but no text in the body mail...
    Does anyone knows the way to send email with a default body text to vendors ?
    best regards,
    Ale

    Hi
    You need to do some configuration for this.
    Goto NACE .
    Select EF and click on OUTPUT TYPES.
    Then select Output Type NEU and click on processing routines .
    In that you have to add a new entry - medium 5 .
    Then you need to assign a program, form routine and form.
    You can use the standard program i.e. SAPFM06P, FORM routine is always ENTRY_NEU and standard MEDRUCK.
    Then in PARTNER FUNCTION you need to add a new entry : medium - 5 and function - VN .
    For subject of the mail goto Mail Title and Texts. In title give PO No. &EKKO-EBELN& .
    Under General data -> Replacement of text symbols give programm as SAPMM06E and Form Routine as
    TEXT_SYMBOL_REPLACE .
    Now the subject will be PO No. 1800004202.
    You need to maintain your email id in tcode SU01 and also the vendor's email id.
    Now while creating a new purchase order , change the medium to External Send .
    Then goto Communication Method and select CS01 . ALSO make sure that the Cover Page Text has value PO No. &EKKO-EBELN& .
    Goto tcode ME9F .
    Execute.
    Select the checkbox and click on Output Message.
    You will get a message MAII 00000000000001 generated .
    If the BASIS guys have made the necessary configuration for sending mail then the mail will go .
    You can see the status and what is sent via tcode SOST.
    Hope it helps
    Best Regards

  • MLGR - external Mail with text in the body

    Hi,
    I have a little problem. I setup the MLGR-Message as defined in the wiki.
    It works fine with SBWP. There is the message text in the body. When I send it
    to an external email-address, then the text is a pdf in the attachment. I'd like to have the text
    also in the body of the external mail, so that the user don't have to open the attachment.
    What do I have do?
    Regards Ralf

    Hi Ralf,
    the easiest solution will be to switch to Medium 5.
    Transmission Medium 5: Communication Strategy - Message Control (CA-GTF-BS) - SAP Library
    and if necessary develop some lines of coding to find the correct mail-addresses and the content-stuff.
    Class CL_BCS is very good documented and is really easy to use.
    or another solution I found in my documents:
    Transaction SO16 --> Send Mail to homeaddress. But that implements that you just send mails to internal users.
    (And I'm not sure, if you just done exact that to get it to external users)
    The SCN-Search brought me this one, but that is what you already got I think:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0e19d4c-b72d-2d10-72ad-a38a70c2a53f?quicklink=index&…
    ~Florian

  • How to sending simple text in the mail body

    Hi friends,
                 How to send simple text in the mail body through ABAP code
       plz send me the related code and setting for that mail.
      Thanks&Regards,
      Srinivas

    try this...
    FORM send_file_as_email_attachment .
      DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
      DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA : i_body TYPE soli_tab WITH HEADER LINE.
    DATA: it_attach LIKE it_display1 OCCURS 0 WITH HEADER LINE.
      DATA: doc_chng LIKE sodocchgi1.
      DATA: tab_lines LIKE sy-tabix.
      DATA: att_lines TYPE i.
    DATA: lv_lines TYPE i.
      DATA: file TYPE string.
      data: g_datum like sy-datum.
      data: g_datum1(10) type c.
      DATA: len TYPE n.
      LOOP AT it_email.
        CLEAR : objpack,
                objhead,
                objbin,
                objtxt,
                reclist.
        REFRESH: objpack,
                 objhead,
                 objbin,
                 objtxt,
                 reclist.
        g_datum =     sy-datum - 1.
        concatenate g_datum6(2) '.' g_datum4(2) '.' g_datum+0(4) into
        g_datum1.
    doc_chng-obj_descr = 'Aged Stock more than 45 Days'.
        CONCATENATE 'Aged Stock more than 45 Days' '-' it_email-vkbur INTO
        doc_chng-obj_descr.
        CONCATENATE 'Please find enclosed Aged Stock Details ( >45days ) report as on'
        g_datum1
        INTO objtxt-line SEPARATED BY space.
        APPEND objtxt.
        objtxt-line = ' '.
        APPEND objtxt.
        objtxt-line = 'Regards'.
        APPEND objtxt.
        objtxt-line = 'LIS SAP Projects'.
        APPEND objtxt.
        objtxt-line =
        'PS: Pls send feedback for futher improvements to SAP office.'.
        APPEND objtxt.
        DESCRIBE TABLE objtxt LINES tab_lines.
        READ TABLE objtxt INDEX tab_lines.
        doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
       CLEAR objpack-transf_bin.
        objpack-head_start = 1.
        objpack-head_num = 1.
        objpack-body_start = 1.
        objpack-body_num = tab_lines.
        objpack-doc_type = 'TXT'.
       objpack-obj_name = 'Run_prog'.
       objpack-obj_descr = 'Agestock.txt'.
       lv_lines = tab_lines.
        APPEND objpack.
    *CONCATENATE 'Plant'   'Material Number' 'Qty(More than 45days)'
    *'Amount' INTO
           it_display SEPARATED BY space.
           append objbin.
           clear: objbin.
        CLEAR:it_display2.
        REFRESH it_display2.
        it_display2-werks = 'Plant|'.
        it_display2-matnr = 'Material Number'.
        it_display2-qty = '|Qty > 45 days'.
        it_display2-amount = '      |Amount'.
        APPEND it_display2.
        it_display2-werks = ''.
        it_display2-matnr = ''.
        it_display2-qty = ''.
        it_display2-amount = ''.
        APPEND it_display2.
        CLEAR : it_display2.
        sort it_display1 by amount descending.
        LOOP AT it_display1 WHERE werks = it_email-vkbur.
         AT FIRST.
    *CONCATENATE 'Plant    '   'Material Number' 'Qty(More than 45days)'
    *'Amount' INTO
           objbin-line SEPARATED BY space.
           append objbin.
           clear: objbin.
         ENDAT.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
            EXPORTING
              input  = it_display1-matnr
            IMPORTING
              output = it_display1-matnr.
          it_display1-qty = TRUNC( it_display1-qty ).
          MOVE-CORRESPONDING it_display1 TO it_display2.
          APPEND it_display2.
          CLEAR:it_display1,it_display2,objbin.
          CLEAR:it_display1.
        ENDLOOP.
        objbin[] = it_display2[].
        DESCRIBE TABLE objbin LINES tab_lines.
        objhead = 'Suug'.
        APPEND objhead.
        objpack-transf_bin = 'X'.
        objpack-head_start = 3.
        objpack-head_num = 1.
        objpack-body_start = 1.
        objpack-body_num = tab_lines.
        objpack-doc_type = 'RAW'.
        objpack-obj_name = 'Run_prog'.
        objpack-obj_descr = 'Agestock.txt'.
        APPEND objpack.
        reclist-receiver = '[email protected]'.
        reclist-rec_type = 'U'.
        APPEND reclist.
    =====================================================================
        CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
          EXPORTING
            document_data              = doc_chng
            commit_work                = 'X'
          TABLES
            packing_list               = objpack
            object_header              = objhead
            contents_bin               = objbin
            contents_txt               = objtxt
            receivers                  = reclist
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            operation_no_authorization = 4
            OTHERS                     = 99.
        CLEAR : it_email.
      ENDLOOP.
    ENDFORM.                    "send_mail
    Message was edited by:
            Sugumar Ganesan

  • When using photo mail with PS12 I cannot write text on the mail page above the picture.

    can not write text on top of picture when I use photo mail with PS12 after entering the email address

    Why did you post this in a forum for Acrobat?

Maybe you are looking for