How to send data in mail body

Hi experts,
I can send all the data of internal table as attachment through mail. But requirement is to send all the data in mail body. No attachment should go with this mail. How to do this?
Regards,
Goutam Sahoo

Hi Check this sample program. Clearly mentioned the body of the message .
<pre>REPORT  zvenkat_mail_simple.
Mail related declarations
"Variables
DATA :
     g_sent_to_all   TYPE sonv-flag,
     g_tab_lines     TYPE i.
"Types
TYPES:
     t_document_data  TYPE  sodocchgi1,
     t_packing_list   TYPE  sopcklsti1,
     t_attachment     TYPE  solisti1,
     t_body_msg       TYPE  solisti1,
     t_receivers      TYPE  somlreci1.
"Workareas
DATA :
     w_document_data  TYPE  t_document_data,
     w_packing_list   TYPE  t_packing_list,
     w_attachment     TYPE  t_attachment,
     w_body_msg       TYPE  t_body_msg,
     w_receivers      TYPE  t_receivers.
"Internal Tables
DATA :
     i_document_data  TYPE STANDARD TABLE OF t_document_data,
     i_packing_list   TYPE STANDARD TABLE OF t_packing_list,
     i_attachment     TYPE STANDARD TABLE OF t_attachment,
     i_body_msg       TYPE STANDARD TABLE OF t_body_msg,
     i_receivers      TYPE STANDARD TABLE OF t_receivers.
"start-of-selection.
START-OF-SELECTION.
  PERFORM send_mail.
  "Form  send_mail
  " PACKING LIST table requires information about how the data in the
  " tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are to be
  " distributed to the documents and its attachments. The first row is
  " for the document, the following rows are each for one attachment.
FORM send_mail .
  "Subject of the mail.
  w_document_data-obj_name  = 'MAIL_TO_HEAD'.
  w_document_data-obj_descr = 'Simple mail using SAP ABAP'.
  "Body of the mail
  PERFORM build_body_of_mail
    USING:space,
          'Hi,',
          'I am fine. How are you? How are you doing ? ',
          'This program has been created to send simple mail',
          'with Subject,Body with Address of the sender. ',
          'Thanks and Regards,',
          'Venkat.O,',
          'SAP HR Technical Consultant.'.
  "Write Packing List (Body)
  DESCRIBE TABLE i_body_msg LINES g_tab_lines.
  w_packing_list-head_start = 1.
  w_packing_list-head_num   = 0.
  w_packing_list-body_start = 1.
  w_packing_list-body_num   = g_tab_lines.
  w_packing_list-doc_type   = 'RAW'.
  APPEND w_packing_list TO i_packing_list.
  CLEAR  w_packing_list.
  "Fill the document data and get size of attachment
  READ TABLE i_body_msg INTO w_body_msg INDEX g_tab_lines.
  w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_body_msg ).
  "Receivers List.
  w_receivers-rec_type   = 'U'.  "Internet address
  w_receivers-receiver   = <give mail id here>.
  w_receivers-com_type   = 'INT'.
  w_receivers-notif_del  = 'X'.
  w_receivers-notif_ndel = 'X'.
  APPEND w_receivers TO i_receivers .
  CLEAR:w_receivers.
  "Function module to send mail to Recipients
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = w_document_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = g_sent_to_all
    TABLES
      packing_list               = i_packing_list
      contents_txt               = i_body_msg
      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.
  IF sy-subrc = 0 .
    MESSAGE i303(me) WITH 'Mail has been Successfully Sent.'.
  ELSE.
    WAIT UP TO 2 SECONDS.
    SUBMIT rsconn01 WITH mode = 'INT'
                 WITH output = 'X'
                 AND RETURN.
  ENDIF.
ENDFORM.                    " send_mail
"      Form  build_body_of_mail
FORM build_body_of_mail  USING l_message.
  w_body_msg = l_message.
  APPEND w_body_msg TO i_body_msg.
  CLEAR  w_body_msg.
ENDFORM.                    " build_body_of_mail</pre>
Thanks
Venkat.O

Similar Messages

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • How to Send Appointment via mail adapter

    Hi Guys,
         I need to send the appointment and vTodo via mail adapter, any way i need to develop a mail adapter module. Till now i have finished this part,and i can send normal mail even normal mail with attachment. But i don't know how to send appointment via mail adapter.
    This is payload content of appointment which got from Exchange server to gmail:
    _=_NextPart_001_01C71EC0.97A011C6
    Content-Type: text/plain;
        charset="GB2312"
    Content-Transfer-Encoding: quoted-printable
    When: 2007=C4=EA6=D4=C227=C8=D5=D0=C7=C6=DA=C8=FD 3:30 =CF=C2=CE=E7-4:00 = =CF=C2=CE=E7 (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi.
    Where: China
    ~*~*~**
    This is calendar content
    _=_NextPart_001_01C71EC0.97A011C6
    Content-class: urn:content-classes:calendarmessage
    Content-Type: text/calendar;
        method=REQUEST;
        name="meeting.ics"
    Content-Transfer-Encoding: 8bit
    BEGIN:VCALENDAR
    METHOD:REQUEST
    PRODID:Microsoft CDO for Microsoft Exchange
    VERSION:2.0
    BEGIN:VTIMEZONE
    TZID:(GMT+01.00) Sarajevo/Warsaw/Zagreb
    X-MICROSOFT-CDO-TZID:21
    BEGIN:STANDARD
    DTSTART:20070112T140000
    TZOFFSETFROM:+0100
    TZOFFSETTO:+0100
    END:STANDARD
    BEGIN:DAYLIGHT
    DTSTART:20070112T140000
    TZOFFSETFROM:+0100
    TZOFFSETTO:+0200
    END:DAYLIGHT
    END:VTIMEZONE
    BEGIN:VEVENT
    DTSTAMP:20061213T141132Z
    DTSTART;TZID="(GMT+01.00) Sarajevo/Warsaw/Zagreb":20070112T140000
    SUMMARY:This is calendar test
    UID:040000008200E00074C5B7101A82E0080000000030D51864C81EC701000000000000000
    010000000CA9F127EA8947844BC4DD47F269BDEA9
    ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="Xu, Rocky":MAILTO:rocky@***.com
    ORGANIZER;CN="Xu":MAILTO:rocky@**.com;roc*@gmail.com
    LOCATION:Shanghai
    DTEND;TZID="(GMT+01.00) Sarajevo/Warsaw/Zagreb":20070112T160000
    DESCRIPTION:This is calendar content\N
    SEQUENCE:0
    PRIORITY:5
    CLASS:
    CREATED:20061213T141132Z
    LAST-MODIFIED:20061213T141133Z
    STATUS:CONFIRMED
    TRANSP:OPAQUE
    X-MICROSOFT-CDO-BUSYSTATUS:BUSY
    X-MICROSOFT-CDO-INSTTYPE:0
    X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
    X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
    X-MICROSOFT-CDO-IMPORTANCE:1
    X-MICROSOFT-CDO-OWNERAPPTID:367904726
    X-MICROSOFT-CDO-APPT-SEQUENCE:0
    X-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE:20061213T141132Z
    X-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE:20061213T141132Z
    END:VEVENT
    END:VCALENDAR
    _=_NextPart_001_01C71EC0.97A011C6--
    My question is
      1. How to generate this kind of payload in mail adapter module?
      2. It is possible to send appointment via mail adapter?
    Following i can get from other system, even using mail package check or not using mail package check.
    BEGIN:VCALENDAR
    METHOD:REQUEST
    PRODID:Microsoft CDO for Microsoft Exchange
    VERSION:2.0
    BEGIN:VTIMEZONE
    TZID:(GMT+08.00) Kuala Lumpur/Singapore
    X-MICROSOFT-CDO-TZID:21
    BEGIN:STANDARD
    DTSTART:16010101T000000
    TZOFFSETFROM:+0800
    TZOFFSETTO:+0800
    END:STANDARD
    BEGIN:DAYLIGHT
    DTSTART:16010101T000000
    TZOFFSETFROM:+0800
    TZOFFSETTO:+0800
    END:DAYLIGHT
    END:VTIMEZONE
    BEGIN:VEVENT
    DTSTAMP:20070608T025852Z
    DTSTART;TZID="(GMT+08.00) Kuala Lumpur/Singapore":20070608T110000
    SUMMARY:This is meeting request with attachment
    UID:040000008200E00074C5B7101A82E0080000000000A9BD0BA7A9C701000000000000000
    010000000C5E16D144D1612498C0EF7E2115EFEC4
    ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="Xu, Rocky
    ":MAILTO:roc*@**
    ORGANIZER;CN="Xu,y":MAILTO:roc*@**
    LOCATION:India labs
    DTEND;TZID="(GMT+08.00) Kuala Lumpur/Singapore":20070608T113000
    DESCRIPTION:This is content!  &#60;&#60;shanghai.txt&#62;&#62; \N
    SEQUENCE:0
    PRIORITY:5
    CLASS:
    CREATED:20070608T025925Z
    LAST-MODIFIED:20070618T033505Z
    STATUS:CONFIRMED
    TRANSP:OPAQUE
    X-MICROSOFT-CDO-BUSYSTATUS:BUSY
    X-MICROSOFT-CDO-INSTTYPE:0
    X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
    X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
    X-MICROSOFT-CDO-IMPORTANCE:1
    ATTACH:CID:008501c7b159$a9d41d3b$_CDOEX
    X-MICROSOFT-CDO-OWNERAPPTID:1468557271
    X-MICROSOFT-CDO-APPT-SEQUENCE:0
    X-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE:20070608T025852Z
    X-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE:20070608T025852Z
    END:VEVENT
    END:VCALENDAR
    Thanks & regards
    Rocky

    Hi
    have a look at this
    You can use Java/ABAP proxies to do this job for you..
    Java Proxy >> will read the mail(with the attachments) with the help of Java APIs and send the message into XI ABAP Proxy >> for this you will have to first convert the attachment into a message and then you can proceed in the regular fashion.
    Not all adapters can process attachments, I'm not sure why you are having trouble with using module processor in the mail adapter. Just check if the service pack that you are using supports this feature.
    If you are on WAS 6.10 and above you can achieve this and there is an excellent weblog by Thomas Jung on this topic at
    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c6d38c5816
    reading Pdf Through mail easly done with Java Proxy, which will read the mail(with the attachments) with Java APIs and send the message into XI and then map with the Target ABAP proxy structure .
    Thanks

  • How to send data to RFC Destination(RFC SENDER Adapter)

    Hi ,
    Scenario:  R/3 Backendà RFC Sender Adapterà XIàsome other system.
    I have configured the RFC destination (of the type TCP/IP) at R/3 System and have registered the Program ID (specified in the RFC destination) in the XI server and using it in the configuration parameters of the RFC Sender Adapter.
    Problem: I do not know how I can send data to the RFC destination. (Should I use a report program/ ABAP Function Module?) Can anybody provide me with a sample code of Report Program/Function module (whichever is required), how to send data to the RFC Destination, so that it may be picked up by my RFC Sender Adapter.
    Thanks and Regards,
    Siva Maranani

    I have one query for you that
    I am trying to develop a scenario in SAP XI
    SAP R/3 ( RFC function module) sends a synchronous request to the XI and SAP XI will send this request to a third party web application using HTTP receiver adapter.
    I am able to send the data/message and it is successfully received at the third party web application.
    But I am facing one issue that I am unable to receive any message/data in my RFC module back.i have seen in sxmb_moni that the two messages are displayed in successfuly processed but in SAP R/3 side nothing get happedned
    Can you tell me how to use some waiting mechanism in function module to wait for the response from SAP XI.
    Regards
    Gopesh

  • How to send data to bam data object through java code

    how to send data to bam data object through java code

    I've made a suggestion in other thread: https://forums.oracle.com/thread/2560276
    You can invoke BAM Webservices (Using Oracle BAM Web Services) or use JMS integration using Enterprise Message Sources (http://docs.oracle.com/cd/E17904_01/integration.1111/e10224/bam_ent_msg_sources.htm)
    Regards
    Luis Fernando Heckler

  • In iCloud, how to send an e-mail to a group of contacts, once I've created the group?

    I have created a group  from my iCloud contacts, but do not see how to send an e-mail message to this group.
    The help topics don't go this far.  Can anyone help?

    Thanks Winnie;  but why didn't that work when I typed in the whole title of the group?   Just the 1st 2 letters did the trick.
    Over & out

  • IDOC :: how to send data from Custom Infotype in SAP HR to third party

    Hi,
    I have created one custom Infotype by number 9020. How to send data from this infotype to third party system and also change pointers need to trigger for this infotype.
    Please help me in doing it.
    I am using one Custom Message type ZTALENT and Custom Idoc Type ZTALENT.
                                                                                    ZTALENT                        Talent Management                                                                               
    5  E1PLOGI                        Header for an HR Object (Master Data or Organizational Data)                                                                               
    5  E1PITYP                        HR: Transported Infotypes and Subtypes for an Object                                                                               
    ZPUSER                         User base Data File                                          
                    ZPERSON                        Personal Information File Segment                            
                    ZPOST                          Position File                                                
                    ZOPE                           Overall Performance                                          
                    ZPWORK                         Outside Work Experience                                      
                    ZPEDUC                         Education Details of Employee                                
                    E1P0000                        HR: HR Master Record Infotype 0000 (Actions)                 
                    E1P0001                        HR: HR Master Record Infotype 0001 (Org. Assignment)         
                    E1P0002                        HR: HR Master Record Infotype 0002 (Personal Data)           
                    E1P0016                        HR Master Record: Infotype 0016 (Contract Elements)          
                    E1P0022                        HR Master Record: Infotype 0022 (Education)                  
                    E1P0023                        HR Master Record: Infotype 0023 (Other/Previous Employers)   
                    E1P0041                        HR Master Record: Infotype 0041 (Date Specifications)        
                    E1P0105                        HR: HR Master Record Infotype 0105 (Communications)       
                   ZE1P9020
                    ZPLANG                         Language Details                                             
                    ZACTION                        Actions Changes            
    Regards,
    Krishna

    Hello Shankar,
             Technically TEMSE files are read by calling the following 3 function modules in sequence,
                  1) RSTS_OPEN_RLC or RP_TS_OPEN: open the temse object
                  2) RSTS_READ : read the object
                  3) RSTS_CLOSE: close the object
    Regards,
    Rajesh

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • How to send an encryted mail

    Hi all,
             I have an issue. How to send an encrypted mail using smartform output.
    I am using the output from smartform and converting it to pdf and then sending that pdf as attachement through mail. But before sending,  i have to encrypt the contents of the mail. Plz anybody know the solution for this issue?

    check this link...
    http://help.sap.com/saphelp_nw04/helpdata/en/4e/c153426da9bd30e10000000a155106/content.htm
    Encrypt.?
    How to Encrypt?

  • How to send birthday wish mail to Employees on daily basis

    Hi ,
    How to send birthday wish mail to employee with greeting card as background image in Mail Content area.
    Is there any Standard program available in SAP.
    _Requirement:_
        Normal , Birthday Wish mail can be done through function module SO_NEW_DOCUMENT_SEND_API1.
        How to write program for getting , Greeting card as background image in Mail Content area.
        Is there solution in SAP .
    Regards
      Surendar

    Hi,
    Check this for embedding image in your email : Using CL_BCS to send email from ABAP
    And this about image as background and other related stuff : http://www.reachcustomersonline.com/2010/01/23/09.27.00/#faqs
    Best regards,
    Guillaume

  • How to send data back to publishing stream

    Hi,
    Environment: ActionScript3.0, FMS, Flash Project created in Flash Develop
    How to send data back to publishing stream? I need to send data back to publishing stream.
    Using NetStream.send() we can send data to subscribers but is it possible to send data from subscriber back to publisher using any NetStream method.
    One other solution to this is remoteSharedObject, but if it is possible with NetStream class then let me know.
    Thanks

    There are a number of ways to extract data from CRM On Demand including:
    * Export - manual process, generate CSV file containing CRM On Demand data
    * List/Analytics - manual process, export the contents of a report of list to a CSV
    * Web Services - programmatic, develop an application that queries for data within CRMOD
    * Integration Events - programmatic, use workflow to trigger event creation and then poll for events to know when an operation occurs on a record (i.e. Insert of new Account record)
    As for getting that data into another system, that will depend on the system and the methods available for inserting data that it makes available.
    Hope this helps.
    Thanks,
    Sean

  • How to send Deadline Monitoring mails to an external mail (LOTUS NOTES)?

    Hi all,
    1. I know how to send Deadline Monitoring mail to an SAP INBOX. But i need to send the deadline monitoring mail to an external email address (LOTUS NOTES or any other email id).
    2. If i am able to send Deadline monitoring mail to the external email address. It will send mail only once but, How to send these deadline monitoring mails for every 3 days until the approver takes some action.
    Please help me...
    Regards,
    Gautham P

    The easy solution is to set up automatic forwarding for everyone by defining the system as NOT being your e-mail system. I don't know where this setting is (the Basis people did it), but with this setting SAP will forward every user's e-mail to the e-mail address in the user record.
    For repeated sending I think you have to use modelled deadlines. Send the deadline message using a normal mail sending step and loop after calculating the new deadline. (i.e. you need to store the deadline in the container and refer to the container elements in your deadline specification.) The deadline calculation can either be a separate step or you can do it as a secondary method in the mail sending step.

  • How to put smartform in mail body

    Hi colleagues,
    I would like to send a mail with content build from a SMARTFORM.  I call the smartform function module and get the corresponding OTF file,  but I did not succeed to put it in a readable way in the mail body.
    How ot get the smartform as mail body?
    My body contains this kind of data, if I do the conversion to PDF:
    ═䑆ⴱ⸳ഊ◢팍ਲu2030扪ഊ⽗楮䅮獩䕮捯摩湧ഊ敮摯扪ഊ㌠〠潢樍਼㰍ਥ䑥癴祰攠南䥎u2020u2020⁆潮琠䍏啒䥅删潲浡氠䱡湧⁅不ਯ呹灥 䙯湴ഊ⽓畢瑹灥 呹灥ㄍਯ䉡獥䙯湴 䍯畲楥爍ਯ乡浥 䘰〱ഊ⽅湣潤楮朠㈠〠刍ਾ㸍੥湤潢樍਴u2030扪ഊ㰼ഊ⽌敮杴栠㔠〠刍ਾ㸍ੳ瑲敡洍ਠ⽆〰ㄠㄲ⸰〠呦u2030⁧⁂吠
    㜰⸸㔠㜵㤮
    and the pdf itself (I also try to attached it to the mail for test) cannot be open.
    I already check a lot of thread, but cannot find any to solve this issue.
    Thanks for your help.
    Barbara

    Hi,
    Refer to this link..Send an smartform as body of a mail

  • How to send output by mail?

    Hi Experts,
    Current output type in our system:
    Document: SD delivey note
    Output type: LD00
    Medium: 1
    Form:  Smartforms.
    Now we are printing delivery note by LD00 and Medium 1.
    In the future, we need to send ducument output to customer by mail, format still as original smartforms.
    Would you please give me a guide line to do this?
    Thank you.
    Richard.

    Hi Richard,
    you need to do following things to send output as an email.
    The output type should have medium 5. thats to send an email. Along with this you need to check following two things.
    if you are using a copy of a standard program it should have code to send an email. Then  you just need to configure following output type with medium '5' to send an email.
    If you dont have code to send it as an email  you can use FM to send it as an email.
    you can use following FM if its an adobe form.
    CALL FUNCTION 'SD_PDF_SEND_DATA'
        EXPORTING
          iv_device        = p_w_device
          iv_email_subject = w_lv_subject
          it_email_text    = w_mail_text
          is_main_data     = p_wa_fp_formoutput
          iv_language      = w_langu
          is_address       = w_ls_address
        IMPORTING
          ev_send_to_all   = w_lv_send_to_all
        EXCEPTIONS
          exc_document     = 1
          exc_send_request = 2
          exc_address      = 3
          OTHERS           = 4.
    Else  for smart form you need to convert it to PDF format first and send it as an email. Refer below code.
    Call Smartform function module.
    CALL FUNCTION fm_name
    EXPORTING
    control_parameters = ssfctrlop
    output_options = ssfcompop
    IMPORTING
    job_output_info = it_otf_data
    TABLES
    it_nfal = it_nfal.
    ***********appending the otf data into the final table*********************
    it_otf_final[] = it_otf_data-otfdata[].
    converting OTF data into pdf data**************************
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    IMPORTING
    bin_filesize = bin_filesize
    bin_file =
    TABLES
    otf = it_otf_final
    lines = it_pdfdata[]
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    err_bad_otf = 4
    OTHERS = 5.
    To send data as email attachment, we need to have a table of SOLISTI1.
    This table contains line size of 255 characters. Below function module
    does the trick of changing the table from X character sized lines into
    any given Y character sized lines.
    REFRESH it_pdf[].
    CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
    EXPORTING
    line_width_dst = '255'
    TABLES
    content_in = it_pdfdata[]
    content_out = it_pdf[]
    EXCEPTIONS
    err_line_width_src_too_long = 1
    err_line_width_dst_too_long = 2
    err_conv_failed = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    "Subject of the mail.
    w_document_data-obj_name = 'MAIL_TO_HEAD'.
    w_document_data-obj_descr = 'Regarding Mail Program by SAP ABAP'.
    "Body of the mail
    w_body_msg = 'This is body of mail msg.'.
    APPEND w_body_msg TO i_body_msg.
    CLEAR w_body_msg.
    "Write Packing List for Body
    DESCRIBE TABLE i_body_msg LINES g_tab_lines.
    w_packing_list-head_start = 1.
    w_packing_list-head_num = 0.
    w_packing_list-body_start = 1.
    w_packing_list-body_num = g_tab_lines.
    w_packing_list-doc_type = 'RAW'.
    APPEND w_packing_list TO i_packing_list.
    CLEAR w_packing_list.
    "Write Packing List for Attachment
    w_packing_list-transf_bin = 'X'.
    w_packing_list-head_start = 1.
    w_packing_list-head_num = 1.
    w_packing_list-body_start = 1.
    DESCRIBE TABLE it_pdf LINES w_packing_list-body_num.
    w_packing_list-doc_type = 'PDF'.
    w_packing_list-obj_descr = 'PDF Attachment'.
    w_packing_list-obj_name = 'PDF_ATTACHMENT'.
    w_packing_list-doc_size = w_packing_list-body_num * 255.
    APPEND w_packing_list TO i_packing_list.
    CLEAR w_packing_list.
    "Fill the document data and get size of attachment
    w_document_data-obj_langu = sy-langu.
    READ TABLE it_pdf INTO w_pdf INDEX g_tab_lines.
    w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_attachment ).
    "Receivers List.
    w_receivers-rec_type = 'U'."Internet address
    w_receivers-receiver = p_mail.
    w_receivers-com_type = 'INT'.
    w_receivers-notif_del = 'X'.
    w_receivers-notif_ndel = 'X'.
    APPEND w_receivers TO i_receivers .
    CLEAR:w_receivers.
    "Function module to send mail to Recipients
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = w_document_data
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = g_sent_to_all
    TABLES
    packing_list = i_packing_list
    contents_bin = it_pdf
    contents_txt = i_body_msg
    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.
    IF sy-subrc = 0 .
    MESSAGE i303(me) WITH 'Mail has been Successfully Sent.'.
    ENDIF.
    ENDIF.
    Edited by: Sumit Naik on Oct 13, 2010 11:20 PM

  • How to send HTML as message body using SMTP

    I need to send HTML formatted emails. I used the Report Generation Toolkit to build my HTML document and make sure I had all of the formatting right. Then I modified the Save Report To File.vi to also give me the HTML text string on an output connector and I wire this string to the message input on the SMTP Email Send Message.vi.
    I receive the email OK, but all I see is the HTML code in the message body. What can I do to make sure that the email displays the message correctly.
    I use Outlook and I know it will receive and display HTML emails, I get them all the time.
    I would appreciate any help.

    Hi Dgw,
    it is similar. You must change message MINE content-type to "text/html" type. Because everyone document in email protocol have set MINE content-type. It is inforamtion for email servers and for email cients (Thunderbird, Outlook and etc.)
    For sendning mail with attachments you must use and modified "SMTP Send Multiple Attachments.vi" - if you can do backup of this VI and subVIs. Open Diagram of "SMTP Send Multiple Attachments.vi" after "SMTP Send Multiple
    Attachments Message.vi" and ther is VI "MIME Send Data Attachment.vi" - have control "MIME content-type" but code from NI don't use it.
    And like as my previous message, create new string control "MINE content-type" and take out this control to "main" Email VI.
    And embedd
    ed file you set up in control-cluster "attachments". I don't test it, but I mind thet must working :-)
    Have nice day
    JCC
    Attachments:
    email.jpg ‏70 KB

Maybe you are looking for