Sending e-mail from ABAP

We need to send email to an external adress from ABAP. Does anybody know a function module or method to do this, maybe even with sample coding?
Best regards
   Dirk

There are some weblogs here:
4.6x and lower:
/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface
6.10 and higher:
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface

Similar Messages

  • Set Sender of Mail from Abap

    Hi,
    I use SO_NEW_DOCUMENT_SEND_API1 function module to send a mail from abap code.
    But I want to set the sender. Can I realize it?
    Regards
    Angela

    Refer this thread -
    Fill "sender id" in SO_NEW_DOCUMENT_SEND_API1
    Regards,
    Amit

  • Abt sending a mail from abap to yahoo

    Anyone can guide with the code of how to send mail from SAP to Yahoo using the ABAP code

    Try this....
    <a href="http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm">http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm</a>

  • Not sending a mail from ABAP SAP R/3

    Using call function "SO_NEW_DOCUMENT_ATT_SEND_API1" in specific program in SAP R/3, i would like to know if it is possible to send a mail on Outlook webmail box in 4.0B Version of SAP?
    Regards, Vincent

    There is two way, you could add plugin to see mail from SAP to your Outlook, or you could send mail from sap to a SMTP.
    To send mail from SAP to SMTP see transaction SCOT. (if you are running an Unix SAP server, that would be easy)
    Regards

  • Sending e-mail from ABAP Code

    Dear All,
    I am try to send mail using FM --> SO_DOCUMENT_SEND_API1.
    But mail not yet received. I am getting error - RAW3500000000099.
    Giving the error as
    No suitable conversion found for XLS and not getting the data in english i.e. getting data in ASCII format
    I think some Setting problem in SCOT.
    Please help me to do the Setting in SCOT or some other place also.
    Kindly help me... i am waiting for your valuable responsible.
    Regards
    Sudhakar

    Hi All,
    Any body has the idea to maintain SX_OBJECT_CONVERT*  function module to convert excel format.
    Please guide me what are the FM to convert data from ascii to raw because i am getting the data in ascii format when i am sending  email to customer. My login language is english.
    Thanks in advance
    Regards
    Sudhakar

  • Function modules to send mails from ABAP

    hi
               can any one give me the function module to send mails from abap to yahoomail or gmail etc. i will be grateful if any one can provide me a sample code.
    thanks & regards
    rajesh

    Hi,
    check this site:
    http://www.sapdevelopment.co.uk/reporting/email/email_mbody.htm
    Replace the
    p_email(40)   type c default '[email protected]' .
    with ur yahoo or gmail id
    This is the FM that u needed:
    'SO_NEW_DOCUMENT_ATT_SEND_API1'
    http://www.kabai.com/abaps/z00.htm
    http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    /people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface
    Hope this solves your question.
    Best Regards,
    Anjali

  • How to send mail from ABAP code?

    Hi,
    I need to send e-mail from ABAP Code .
    e.g:  If sy-subrc ne 0.
         ( send e-mail to  "[email protected]" )
           endif.
    Please provide me any Function module for this or any code.
    Correct answear will be rewarded my maximum points.
    Thanks & Regards,
    Gaurav.

    Check this code sample
    * Send mail
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      loop at htmllines.
        mailtxt = htmllines.
        append mailtxt.
      endloop.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           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 SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Regards.

  • Problem sending externail mail from SAP

    I am facing problem in sending external mail from SAP. for ex: yahoo, hotmail like that. But, i can able to send the mails to my domain ids. I have configured both the SMTP and SAP internet gateway to send mails.
    But, i dont know what could be the problem in sending external mails.
    Is there any body to help me in this regard
    Regards,
    B.Sudharsan

    Hi Sudarsan,
    How are you trying to send an e-mail using ABAP or using actions or ?
    Enclosed link gives you a complete overview of the settings and the way to send an e-mail using ABAP ( if necessary).
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Reward points if it helps.
    Regards,
    Vamsi Krishna P.

  • Problem  while sending the mail from sap

    Hi experts,
                     I am facing some problem while sending mail from sap to external mail.
    this is th code i am using but it is not working. plz check and tell me.
    REPORT  ZMAIL_DEMO.
    data: maildata type sodocchgi1.
    data: mailtxt type table of solisti1 with header line.
    data: mailrec type table of somlrec90 with header line.
    start-of-selection.
    break-point.
    clear: maildata, mailtxt, mailrec.
    refresh: mailtxt, mailrec.
    maildata-obj_name = 'TEST'.
    maildata-obj_descr = 'Test'.
    maildata-obj_langu = sy-langu.
    mailtxt-line = 'This is a test'.
    append mailtxt.
    mailrec-receiver = 'SOME MAIL ID'.
    mailrec-rec_type = 'U'.
    append mailrec.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
    exporting
    document_data = maildata
    document_type = 'RAW'
    put_in_outbox = 'X'
    tables
    object_header = mailtxt
    object_content = mailtxt
    receivers = mailrec
    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.   "( did not receive any mail) *
    write : 'mail sent'.
    endif.

    Hi,
    Please check with the following code.
    TABLES: KNA1.
    data for send function
    DATA DOC_DATA  LIKE SODOCCHGI1.
    DATA OBJECT_ID LIKE SOODK.
    DATA OBJCONT   LIKE SOLI OCCURS 10 WITH HEADER LINE.
    DATA RECEIVER  LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
    SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
      WRITE:/ KNA1-KUNNR, KNA1-ANRED.
    send data internal table
      CONCATENATE KNA1-KUNNR KNA1-ANRED
                             INTO OBJCONT-LINE SEPARATED BY SPACE.
      APPEND OBJCONT.
    ENDSELECT.
    insert receiver (sap name)
      REFRESH RECEIVER.
      CLEAR RECEIVER.
      MOVE: 'any_email'_ TO RECEIVER-RECEIVER,                " SY-UNAME
            'X'      TO RECEIVER-EXPRESS,
            'U'      TO RECEIVER-REC_TYPE.
      APPEND RECEIVER.
    insert mail description
      WRITE 'Sending a mail through abap'
                     TO DOC_DATA-OBJ_DESCR.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
         EXPORTING
              DOCUMENT_DATA              = DOC_DATA
         IMPORTING
              NEW_OBJECT_ID              = OBJECT_ID
         TABLES
              OBJECT_CONTENT             = OBJCONT
              RECEIVERS                  = RECEIVER
         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.

  • Sending .xlsx file from ABAP

    Hi Experts,
    How can we send .XLSX file from ABAP.
    I have done as suggested in note 1459896 but it's not working.
    I have added the header table with such value
    concatenate '&SO_FILENAME=' lv_filename into lv_text_line.
      append lv_text_line to lt_att_head.
    passing header table to
    lo_document->add_attachment( exporting i_attachment_type = 'XLS'
                                      i_attachment_subject = 'AttachmentFilename'
                                      i_attachment_size = lv_size
                                      i_attachment_header = lt_att_head
                                      i_att_content_hex    = binary_content ).
    but when I try to open it in SOST it says," file format or extension is not valid " .
    Do you think if I send thsi mail to outlook it will work. ?
    Thanks
    Willi

    But SAP note says 1459896 , it can be done
    using
    filename = 'attachment.xlsx'
    concatenate '&SO_FILENAME=' lv_filename into lv_text_line.
      append lv_text_line to lt_att_head.
    but still not working.

  • How will we send smtp mail from SAP via Exchange

    Hi;
    We changed SAP OS between Windows and Linux and still 4.6c . Now we use linux OS.
    We used smtp mail at SAP via Exchange with 3.party (sendmail,indigomail etc.) But Now I dont know how will we send smtp mail from SAP.
    Please help me,
    Thanks for answers.
    Moderator message: not directly related to ABAP development, please have look in the Netweaver forums, also search for available information on sending emails.
    Edited by: Thomas Zloch on Nov 22, 2010 2:39 PM

    Hi,
    What is the nature of the URL you wish to include in the e-mail ?
    Is it fixed or dynamic ?
    Cheers
    Colin.

  • To send external email from ABAP

    How to send external email from ABAP Program and what are the settings to be done for the same ?

    Please check..
    Sending External email through SAP
    What is the FM for sending the external email through SAP by attaching layout set  to it?
    These are the FM for sending external email :-
    SO_DOCUMENT_SEND_API1 
    SAPoffice: Send new document with attachments via RFC 
    SO_NEW_DOCUMENT_ATT_SEND_API1
    (In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
    SAPoffice: Send new document with attachments via RFC 
    Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject. 
    SO_NEW_DOCUMENT_SEND_API1 
    SAPoffice: Send new document 
    How to send a report to an external mail-id?
    Try this sample code :-
    REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
    DATA : BEGIN OF ITAB OCCURS 0,
    PERNR LIKE PA0001-PERNR,
    ENAME LIKE PA0001-ENAME,
    END OF ITAB.
    DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
    receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
    packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
    listobject LIKE abaplist OCCURS 10,
    compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
    w_object_hd_change LIKE sood1,
    compressed_size LIKE sy-index.
    START-OF-SELECTION.
    SELECT PERNR ENAME
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    FROM PA0001
    WHERE PERNR < 50.
    LOOP AT ITAB.
    WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
    SY-VLINE.
    ENDLOOP.
    Receivers
    receiver_list-recextnam = '[email protected]'. "-->
    EMAIL ADDRESS
    RECEIVER_list-RECESC = 'E'. "<-
    RECEIVER_list-SNDART = 'INT'."<-
    RECEIVER_list-SNDPRI = '1'."<-
    APPEND receiver_list.
    General data
    w_object_hd_change-objla = sy-langu.
    w_object_hd_change-objnam = 'Object name'.
    w_object_hd_change-objsns = 'P'.
    Mail subject
    w_object_hd_change-objdes = 'Message subject'.
    Mail body
    APPEND 'Message content' TO message_content.
    Attachment
    CALL FUNCTION 'SAVE_LIST'
    EXPORTING
    list_index = '0'
    TABLES
    listobject = listobject.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    compressed_size = compressed_size
    TABLES
    in = listobject
    out = compressed_attachment.
    DESCRIBE TABLE compressed_attachment.
    CLEAR packing_list.
    packing_list-transf_bin = 'X'.
    packing_list-head_start = 0.
    packing_list-head_num = 0.
    packing_list-body_start = 1.
    packing_list-body_num = sy-tfill.
    packing_list-objtp = 'ALI'.
    packing_list-objnam = 'Object name'.
    packing_list-objdes = 'Attachment description'.
    packing_list-objlen = compressed_size.
    APPEND packing_list.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = w_object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = message_content
    receivers = receiver_list
    packing_list = packing_list
    att_cont = compressed_attachment.

  • E72- Unable to send e-mail from work mailbox

    I am unable to send e-mails from my work e-mail through my E72 although it receives perfectly. I have been in contact with Nokia via e-mail for the last 2 weeks and they have sent several suggestions to solve the issue but nothing is working. I have set-up my work e-mail on my husbands Blackberry  with the same settings and can receive and send perfectly. From that I conclude there is no issue with the settings I have or my work e-mail but with
    Nokia!! The latest 'help' I have received was to download a patch but I have no idea how to do this and get it onto my phone. So far Nokia have not replied to me.
    Any suggestions how to get this to work would be greatly appreciated

    If you're using a much older firmware, updating the phone would be a good idea.  Find the Software Updates section of nokia.com and type your phone model.  If you can't do an over-the-air update, download and install either the OVI Suite or the standalone Software Updater.  This may hard reset the phone, so back up anything important with OVI Suite first.
    Ignoring firmware for now, IMAP and URL's are like apples and oranges.  If you work for a small company, the server may always be called " mail.mycompany.com", but IMAP will never use an HTTP or HTTPS prefix.  URL's are typically associated with Microsoft Exchange servers.  Within the email program, check Options -> Settings -> Mailbox settings -> Mailbox settings -> Advanced mailbox settings.  Are "Outgoing email settings" set to something like
    User authentication: Same as for incoming
    Outgoing mail server: <compare to the setting for the Incoming server name; in a small company this will likely be the same>
    Since you're getting far enough for the mail sever to reject your connection, the other settings should be fine as-is.
    It does look like an authentication issue, so I'd say you're either hitting the wrong server or there's a bad username or password in there somewhere.  If the Blackberry works with an IMAP connection, then you should be using the same server name(s), and user/password.
    If all else fails, you can always try removing and readding the mailbox completely.  Choose Menu -> Applications -> Email -> Settings -> <highlight your work account> -> Options -> Remove mailbox.  And then set it up from scratch.  I hope that helps a little!

  • Why can I not send e-mails from my e-mail account? I can receive e-mails. Not an iCloud account. It is a Bell Aliant account.

    Why can I not send e-mails from my e-mail account? I can receive e-mails. It is not an iCloud account it is a Bell Aliant account. An account I pay for.
    This is the second time in three months this has occurred. Bell Aliant suggested I contact Apple directly as the only option is to remove my e-mail account and reconfigure it. This will mean losing all my files. These files are very important as my account is a business account.
    Bell Aliant thought perhaps it is an Apple problem and that Apple may better be able to remedy the situation without me losing my e-mail files.

    Sorry ?
    An Internet email provider losses all your Mail and it's Apple's fault ??
    Did they explain how the app managed to delete all of your mail and then not even let you have access ?
    If that was the case the app should still be able to access the empty folders.
    I know there is often blame and counter blame in these situations but there are limits.
    9:50 pm      Friday; April 10, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Can not send e-mails from account but can receive

    I have my e-mail account with ATT Yahoo.
    I received an account verification notice yesterday from ATT and I responded and they said I was verified.
    However after I did that I could not send e-mails from my Imac desktop but I am receiving them.
    I spend 4 and a half hours, yes 41/2 hours with both Apple Care and ATT and they could not correct the problem. Both discussions were with upper tier support personnel.
    Here are some facts that make this an odd issue:
    (1)
    I have other e-mail boxes from ATT and they can send and receive e-mails.
    (2)
    MY laptop can still send and receive e-mails from the e-mail account that is only receiving with my Imac.
    (3)
    All the settings are exactly the same and both Apple Care and ATT checked them.
    Is there anybody out there that may have an answer ?
    Both Apple Care and ATT blamed each other.
    My concern is that today I received another e-mail trying to verify my e-mail address for another e-mail address from ATT.
    I called ATT and they did not know why, I DID NOT open it up and trashed it.
    ATT has put a filter on my other e-mail accounts and hopefully that will end any problems with them.
    The account that has the issue is my main account and I cannot trust leaving it and am trying to avoid having to change it.
    Greg

    Hi Rachel, For what it will be worth, I was like a dog with a bone about this, so I decided to give it another go. I have success on both boxes. Here is what I did, I warn you now it was a lengthy process. Before you begin download all the upgrade steps from X.5.0 to X.5.6 as single stages ( for me the combo's did not work) and have them ready to use.
    1st Backup all your mail to CD/DVD not on the box. Check for any unsent mails anywhere in the box and then throw out all of the mail bits that are anywhere on the system in any folder. 2nd Install & Archive, 3rd Start up from Install DVD and check/set permissions, reboot. Enter all your ISP details to mail, see if you can send a mail to yourself. If not dump all the mail you tried and the .plists, reboot and install next update in the series, enter all details as before, try and send etc. If this fails dump again and reboot install next update etc.
    I started at X.5.1 and got to vX.5.4 before I got a result in that sys asked me if this server will do, I said yes and I got mail out. The server name was different that was offered but when all was over it showed as the correct one that it should be on port 995. I must add that I had the spinning cog wheel for quite some minutes before anything happened. I continued on this way for the rest of the updates. 1x1 until v.6 was reached. That was only on the G4, I now had to do it all again on the MacPro. This one was not so co-operative in that I had to do it twice, but now it also has Mail running. It is funny though that I had to reach X.5.4 on both machines before it came right. On the G4 I was using a retail disc and on the Intel the supplied for discs.
    Others on here may have a better and quicker way, but for me this did work. I am sure that there is a problem in either the mail app itself or the production of the Master DVD's.
    Whatever, good luck.

Maybe you are looking for

  • Icons not staying on the dock

    HI, Yesterday, I picked up my phone, took it out of sleep mode and my dock on the bottom of the screen was empty. All of the icons I keep there were on the main app pages. I try to drag the icons back to there but they wont dock to the dock. Anyone e

  • TS1372 I have an error message 1601 and yet I am referred to error messages in the 1400s.  Is this the same issue?

    I have an error message 1601 and yet I am referred to error messages in the 1400s.  Is this the appropriate article for figuring out why itunes does not recognize the ipod?  Apparently, this is preventing my device from loading new music.

  • Tree and event

    How can I know the node on mouse move ? How can I croll a tree in programm ? How can I show a particular node in programm ?

  • Upload Maximum Date Rate Lower Than Upload Data Ra...

    Hello there, I have just brought up my BT Home Hub 5 stats and my upload data rate is higher than my upload maximum date rate. Is this normal? My upload noise margin has dropped to 4.9 - 5.1 dB. I've had BT Infinity just over 2 days and was wondering

  • How can I close the audio editor

    Is here a key command to go to or close the audio editor and return to the main page. ex: P: for piano roll, X; for mixer