<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sending E-Mail in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735998#M635503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got another question, after solving the ones above.&lt;/P&gt;&lt;P&gt;Is it somehow possible to add a 'reply to' email addy or hide my email, since I dont want any replies to this automaticly generated message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Sep 2007 09:40:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-18T09:40:37Z</dc:date>
    <item>
      <title>Sending E-Mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735994#M635499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found an example code for sending E-Mails to an external address and tried it out. It worked perfectly, I received the E-Mail in my inbox... the second and the following times I run the programm, it wouldn't send the E-Mail anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Meaning the programm only send the E-Mail on the first attempt.. what could be the reason for that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZSENDEMAIL                                                  *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Example of sending external email via SAPCONNECT                    *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*


REPORT  z_tl78_121007_email.

PARAMETERS: psubject(40) TYPE c DEFAULT  'Hello',
            p_email(40)   TYPE c DEFAULT 'abc@test.com'.

DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
        it_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
        it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
        it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
        gd_cnt TYPE i,
        gd_sent_all(1) TYPE c,
        gd_doc_data LIKE sodocchgi1,
        gd_error TYPE sy-subrc.

DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                WITH HEADER LINE.

***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

  PERFORM populate_message_table.

*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
  PERFORM send_email_message.

*Instructs mail send program for SAPCONNECT to send email(rsconn01)
  PERFORM initiate_mail_execute_program.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  POPULATE_MESSAGE_TABLE
*&amp;amp;---------------------------------------------------------------------*
*       Adds text to email text table
*----------------------------------------------------------------------*
FORM populate_message_table.
  APPEND 'Email line 1' TO it_message.
  APPEND 'Email line 2' TO it_message.
  APPEND 'Email line 3' TO it_message.
  APPEND 'Email line 4' TO it_message.
ENDFORM.                    " POPULATE_MESSAGE_TABLE


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SEND_EMAIL_MESSAGE
*&amp;amp;---------------------------------------------------------------------*
*       Send email message
*----------------------------------------------------------------------*
FORM send_email_message.
* Fill the document data.
  gd_doc_data-doc_size = 1.

* Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu.
  gd_doc_data-obj_name  = 'SAPRPT'.
  gd_doc_data-obj_descr = psubject.
  gd_doc_data-sensitivty = 'F'.

* Describe the body of the message
  CLEAR it_packing_list.
  REFRESH it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 0.
  it_packing_list-body_start = 1.
  DESCRIBE TABLE it_message LINES it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'.
  APPEND it_packing_list.

* Add the recipients email address
  CLEAR it_receivers.
  REFRESH it_receivers.
  it_receivers-receiver = p_email.
  it_receivers-rec_type = 'U'.
  it_receivers-com_type = 'INT'.
  it_receivers-notif_del = 'X'.
  it_receivers-notif_ndel = 'X'.
  APPEND it_receivers.

* Call the FM to post the message to SAPMAIL
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = gd_doc_data
      put_in_outbox              = 'X'
    IMPORTING
      sent_to_all                = gd_sent_all
    TABLES
      packing_list               = it_packing_list
      contents_txt               = it_message
      receivers                  = it_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.

* Store function module return code
  gd_error = sy-subrc.

* Get it_receivers return code
  LOOP AT it_receivers.
  ENDLOOP.
ENDFORM.                    " SEND_EMAIL_MESSAGE


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  INITIATE_MAIL_EXECUTE_PROGRAM
*&amp;amp;---------------------------------------------------------------------*
*       Instructs mail send program for SAPCONNECT to send email.
*----------------------------------------------------------------------*
FORM initiate_mail_execute_program.
  WAIT UP TO 2 SECONDS.
  IF gd_error EQ 0.
    SUBMIT rsconn01 WITH mode = 'INT'
                  WITH output = 'X'
                  AND RETURN.
  ENDIF.
ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone got a clue, or any suggestions .. another way of sending E-Mails to an external E-Mail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Yilmaz Akarsu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2007 12:13:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735994#M635499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-12T12:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sending E-Mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735995#M635500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add the commit_work parameter to the function call ie&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Call the FM to post the message to SAPMAIL
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data            = gd_doc_data
      put_in_outbox            = 'X'
      commit_work              = 'X'
............
............
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2007 12:21:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735995#M635500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-12T12:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sending E-Mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735996#M635501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi akarsu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;again u use the function module to connect&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2007 12:23:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735996#M635501</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-12T12:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sending E-Mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735997#M635502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick response, I must have missed that one.. thanks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got another question, I am looking for something like a distributer-list, is it possible to send out an e-mail to several receivers ( I guess so ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've already checked the forums and found some answers but those wouldn't help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a side not, I'm kinda very new to the whole ABAP world, sorry for that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2007 12:31:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735997#M635502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-12T12:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sending E-Mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735998#M635503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got another question, after solving the ones above.&lt;/P&gt;&lt;P&gt;Is it somehow possible to add a 'reply to' email addy or hide my email, since I dont want any replies to this automaticly generated message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2007 09:40:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-e-mail/m-p/2735998#M635503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-18T09:40:37Z</dc:date>
    </item>
  </channel>
</rss>

