Send email from WDA

Hi,
I would like to send an email from Web dynpro ABAP.
How can I proceed to do this ???
Code samples are most welcome.
Thx,
Suba

Hi RAM,
If your problem is not solved yet then please use following code for ur reference. Its a running code for which i have used Thomas Jung's blog .
Its very easy so just understand the code step by step.
Here i am sending an internal table to a customer .
  DATA: l_text1  TYPE char255. " Text
  DATA: l_lines TYPE i,
        l_size  TYPE  sood-objlen. " Size of Attachment
  DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
  DATA lo_api_controller     TYPE REF TO if_wd_controller.
  lo_api_controller ?= wd_this->wd_get_api( ).
  lo_message_manager = lo_api_controller->get_message_manager( ).
* Mail related
  DATA: i_content TYPE   soli_tab, " Mail content
        i_attach  TYPE   soli_tab. " Attachment
  DATA: l_send_request    TYPE REF TO    cl_bcs,  " E-Mail Send Request
        l_document        TYPE REF TO    cl_document_bcs,  " E-Mail Attachment
        l_recipient       TYPE REF TO    if_recipient_bcs, " Distribution List
        l_sender          TYPE REF TO    if_sender_bcs,  " Address of Sender
        l_uname           TYPE           salrtdrcpt,  " Sender Name(SY-UNAME)
        l_bcs_exception   TYPE REF TO    cx_document_bcs, " BCS Exception
        l_addr_exception  TYPE REF TO    cx_address_bcs,  " Address Exception
        l_send_exception  TYPE REF TO    cx_send_req_bcs. " E-Mail sending Exception
*        l_SO_OBJECT_MIME_GET type ref to SO_OBJECT_MIME_GET.
  DATA: l_recipient_soos  TYPE  soos1.
  DATA: lv_i_with_error_screen TYPE os_boolean.
  DATA: lv_result TYPE os_boolean.
  CONSTANTS: c_tab(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,  " Tab Character
             c_cr(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf, " Line Feed for End-Of_line
             c_ext    TYPE soodk-objtp VALUE 'XLS'. " XLS Extension
  DATA p_uname TYPE so_dir_ext .
  p_uname = 'sumit.goenka -avaya.co.in'.
* Preparing body of the Mail
  MOVE 'Please execute the trade given in the attached excel file' TO l_text1.
  APPEND l_text1 TO i_content.
  MOVE '' TO l_text1.
  APPEND l_text1 TO i_content.
  MOVE '' TO l_text1.
  APPEND l_text1 TO i_content.
  MOVE 'Warm Regards SAP' TO  l_text1.
  APPEND l_text1 TO i_content.
* Preparing contents of attachment with Change Log
  FIELD-SYMBOLS: <lfs_table> TYPE ANY,    " Internal table structure
                 <lfs_con> TYPE ANY.      " Field Content
  DATA: l_text TYPE char1024.    " Text content for mail attachment
  DATA: l_con(50) TYPE c.        " Field Content in character format
* Columns to be tab delimeted
  LOOP AT detail ASSIGNING <lfs_table>.
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
             TO <lfs_con>.
      IF sy-subrc NE 0.
        CONCATENATE c_cr l_text INTO l_text.
        APPEND l_text TO i_attach.
        EXIT.
      ELSE.
        CLEAR: l_con.
        MOVE <lfs_con> TO l_con.
        CONDENSE l_con.
        IF sy-index = 1.
          CLEAR: l_text.
          MOVE l_con TO l_text.
        ELSE.
          CONCATENATE l_text l_con INTO l_text
             SEPARATED BY c_tab.
        ENDIF.
      ENDIF.
    ENDDO.
  ENDLOOP.
* Creates persistent send request
  TRY.
      l_send_request = cl_bcs=>create_persistent( ).
* Creating Document
      l_document = cl_document_bcs=>create_document(
                                    i_type  = 'RAW'
                                    i_text  = i_content[]
                                    i_subject = 'Buy / Sell Order' ).
      DESCRIBE TABLE detail LINES l_lines.
* Size to multiplied by 2 for UNICODE enabled systems
      l_size = l_lines * 2 * 255.
* Adding Attachment
      CALL METHOD l_document->add_attachment
        EXPORTING
          i_attachment_type    = c_ext
          i_attachment_size    = l_size
          i_attachment_subject = 'Buy Sell Order Detail'
          i_att_content_text   = i_attach[].
* Add document to send request
      CALL METHOD l_send_request->set_document( l_document ).
* Get Sender Object
      l_uname = sy-uname.
      l_sender = cl_sapuser_bcs=>create( l_uname ).
      CALL METHOD l_send_request->set_sender
        EXPORTING
          i_sender = l_sender.
* E-Mail
      TRANSLATE p_uname TO UPPER CASE.
      l_recipient_soos-recesc = 'U'.
      l_recipient_soos-recextnam = p_uname.
* Preparing recepient from SAP Logon Name
      CALL METHOD cl_send_request_bcs=>create_recipient_from_soos1
        EXPORTING
          i_soos1 = l_recipient_soos
        RECEIVING
          result  = l_recipient.
* Add Recipient
      CALL METHOD l_send_request->add_recipient
        EXPORTING
          i_recipient  = l_recipient
          i_express    = 'U'
          i_copy       = ' '
          i_blind_copy = ' '
          i_no_forward = ' '.
*Trigger E-Mail immediately
      l_send_request->set_send_immediately( 'X' ).
      CALL METHOD l_send_request->send( lv_result ).
      IF lv_result IS INITIAL.
*       *    report message
        CALL METHOD lo_message_manager->REPORT_SUCCESS
          EXPORTING
            message_text = 'Mail sent successfully '.
      ENDIF.                                                              .
      COMMIT WORK.
    CATCH cx_document_bcs INTO l_bcs_exception.
    CATCH cx_send_req_bcs INTO l_send_exception.
    CATCH cx_address_bcs  INTO l_addr_exception.
  ENDTRY.
if any doubt please ask.
regards
panky

Similar Messages

  • Cannot send email from yahoo account on iPhone 5

    I just got an iPhone5 and I couldn't set up my Yahoo email as "yahoo"--it would not allow me to complete the process despot multiple attempts. I had to set it up as an "other" account. I can receive and read emails on my phone, but when I reply those messages will not send. They go to the outbox and an error message pops up that says" the email account has been rejected by the server" Does anyone have advice on either issue: setting up yahoo properly and/or sending email from phone?

    outgoing mail server
    SMTP - Yahoo! SMTP Server
    primary server
    Yahoo! SMTP server - ON
    server port 465
    That's what I have for my yahoo account.

  • Cannot send email from non .mac server

    I am only able to send/reply emails using my .mac address. My 2 other server addresses keep giving me the following message.
    "Cannot send mail. One of the recipient addresses was invalid".
    How can I fix this?

    You should be able to send email from Safari, however I do wonder why you wish to do this and whether there is something inherently wrong with using your mail app and your iCloud address.

  • Cannot send email from MobileMe account

    Apple recently pushed out an update to the MobileMe calendar. Since upgrading my account, I am unable to send emails from Firefox4 (current version) in Windows. The page sits indefinitely at a loading screen. Apple Support won't help because it isn't an issue with Safari. Anyone else have this issue?

    When using the MobileMe account preset to create the account, the SMTP server is created with 587 as the SMTP server port, which can't be changed when using the MM account preset to create the account.

  • Cannot send email from an iPhone to a Outlook group.

    Hi,
    My question is simple and I'd like an exactly same answer : Can iPhone users send emails from their iPhone's to one or more groups created in Outlook?
    This is my situation: our organization is using iPhone to provide email, calendar, contact, task etc. to some of their employees. We are using Airwatch MDM Agent on user's iPhone because we have an Airwatch server in place. I have an user and she has an iPhone 5 and she has created some groups in Outlook but these groups are not reflected in her Contacts in the iPhone. I have update her phone with the latest update, although I was almost sure that this was not the issue, then I've found some interesting posts on internet saying that this was a known problem for the users with the previous iOS but I thought this might has been corrected with the iOS, apparently not.
    Also I've tried ''the trick'' that is posted on several forums with the iCloud but neither so it's working. I am looking for a straight answer, if this works or not on iPhone's?
    Thanks,
    Sebastian.

    There indeed ARE apps in the app store that will do what you want.  Just search and find the one that best fits your needs.

  • Cannot send email from scanned pages

    I am having trouble with the updated HP remote app on Ipad, since the update I can scan the pages in, but then cannot send them via email. This is qute important because i work remotley from the office and rely on getting my design drawings in on a nightly basis
    please help

    cannot send email from scanned pages

  • Cannot send email from ipad?

    I can receive, but cannot send emails from my iPad. Always get message that I have wrong user name or password.

    Then make sure that the settings are correct in your email account.
    Check the outgoing mail server setting. Make sure that your username and password are in there.
    Settings>Mail, Contacts, Calendars>Your email account>Account>Outgoing mail server - tap the server name next to SMTP and check in the primary server and make sure your username and password are entered and correct - even if it says that the password is optional.

  • Cannot send email from Exchange 2007 to Exchange 2013

    Hello Anyone,
    Anyone can help? I've prepare MS Exchange 2013 already, for Migration MS Exchange 2007 and I got the issue.
    My issue is I can't send email from Exchange 2007 to Exchagen 2013, but for Exchange 2013 can send email to Exchange 2007,
    is my issue only internal email for external email both Exchange server is working fine.
    Regards,
    Eakkasak

    Thanks for your reply, when I send email from Exchange 2007 to Exchange 2013 I'm get the error message below.
    Delivery is delayed to these recipients or distribution lists:
    Eakkasak Buajan
    Subject:
    This message has not yet been delivered. Microsoft Exchange will continue to try delivering the message on your behalf.
    Delivery of this message will be attempted until 8/29/2014 8:30:29 PM (GMT+07:00) Bangkok, Hanoi, Jakarta. Microsoft Exchange will notify you if the message can't be delivered by that time."
    I'm already tick  "Exchange server Authentication" in the Default Receive connector properties of Exchange 2013"
    I'm restart services and restart all Exchange Server but doesn't work.
    Thanks,
    Eakkasak
    Sent by Microsoft Exchange Server 2007

  • Cannot send email from my mobileme on iphone 3g

    Suddenly coudn't access my mobileme email account. So I changed my password; and since I couldn't send email from my iphone 3G
    I can send/receive emails from icloud webpage or Thunderbird.
    Any clues?

    outgoing mail server
    SMTP - Yahoo! SMTP Server
    primary server
    Yahoo! SMTP server - ON
    server port 465
    That's what I have for my yahoo account.

  • Cannot send email from Iphone. A setting is off.

    What are the correct settings to send email from my aol account that's included in my I Cloud acct. any suggestions???? Thanks Sue

    Read this
    How do I set up AOL Mail on my iPhone or iPod Touch? - AOL Help

  • Cannot send email from outbox

    Why can't i send email from my outbox? Mail is blocked from coming in also.

    Check your settings, maybe the mail index is at fault.
    Setup Wizard and troubleshooting tips:
    http://www.apple.com/support/mail
    Also has a link to Mail community section.

  • Cannot send email from Exchange 2007 to Exchange 2013 - Coexistence

    Existing Exchange 2007 SP3 1 MBX, 2 CAS/HT, 2 ET servers.
    I have added an Exchange 2013 server with MBX/CAS role.
    Email will flow from Ex2013 server no problem.  Mail from Ex2007 systems cannot deliver to Ex2013 boxes, it dies in queue with a 4.4.7 expired message after issuing a delay message.
    I can telnet to ports 25, 587,717,465,475, and 2525 from Ex2007 HT role to new Exchange 2013 server.  I can send email from Ex2007 HT role server to new Exchange 2013 server using telnet to port 25.
    A ‘get-mailbox’ from the Ex2007 HT role server returns the server and database properly on the test users on Exchange 2013 server.
    The only strange thing I am seeing is from the Ex2007 systems, a ‘get-exchange server’ command shows the new Ex2013 server as role ‘16439’ which looks to perhaps be normal.
    Why is email not flowing to the new users on Exchange 2013?

    You should have exchange server authentication ticked in Default Receive connector in Exchange2007.
    Exchange 2007 and Exchange 2013 in the same subnet/network. if not please check any spam agent running between the networks. Are you running antispam on Exchange2013 ?
    MAS

  • Cannot Send Email from SAP Business One

    Hi Experts
    I have configured SAP Email Services from the Mailer Service and Customer can send emails all the while,
    Now I have an Issue for One User,
    Iam using the Same Machine, Same Database with Manager Login, I can send Email from SAP with Attachments
    But When I use another Super user the system is not delivering the Email and it Goes to the Sent box (but not delivered)
    Have anyone encountered the Issue before
    Please hep to solve this issue permanently
    Thanks and Regards
    Vinodh Kumar Mohan

    Hi Vinodh Kumar Mohan,
    If the email can be found in Sent box, it must be delivered already.
    The problem could be on the email recipient side. It may go to the junk mail.
    Thanks,
    Gordon

  • "Cannot send email from this device"?

    I recently purchased the Easy Release App from the ITunes store and when I try to email the release to my email address it says "Cannot send email from this device". Is it the app that is preventing the sending or is it something to do with the iPod? I've tried sending an email from the iPod to see and it is sent fine from the iPod but the app still won't send from the iPod.
    Has this ever happened to someone else? Do I have to change settings on my iPod?
    I have the IPod 4th generation if that helps

    I had the same problem. You have to go into Settings in your ipod touch, scroll down and find "mail, contacts, calendars." Set up your email in there. It will give you a list I.e. yahoo, hotmail, gmail. After you've dont that you'll be able to sent the model release.

  • Cannot send email from within iPhoto

    Using OX X 10.7.5 cannot send email from within iPhoto.  I get this error message: "Your email did not go through because the server did not reply."
    If I change the preference to use email, everything goes fine but I lose the formatting feature.

    iPhoto Menu ->
    Preferences ->
    Accounts ->
    Delete and recreate your email settings.
    Alternatively, use Apple's Mail for the job. It has Templates too - and more of them. Check out the Stationery...

Maybe you are looking for

  • Is Photoshop CS2 free after all or no joy?

    Hello, ive been a long time photoshop user, i believe pre cs2, i imediatelly liked this piece of software since the first day i used it, it was easy to use, intuitive with a set of powerfull features that would speed up my image developments, i used

  • What is wrong with my 2730p? (Lag, Mouse Device Problems)

    long story short, i have been having tremendous usability issues with my laptop, including mouse problems and tremendous lag (both with and without the hdd), and missing/broken system files which sfc/ scannow fails at fixing. the system in question h

  • Re: skype to go number is not working

    It doesn't recognize ANY registered number, but sure KEEP EATING MY MONEY in the process of trying to fix it.It is so frustrating...Maybe it's time to change to Google voice!

  • Tracking Projects in Fixed Assets

    A consultant told us that Oracle has an add-on, or plug-in, that would allow us to track project level information in FA without having to use Oracle Projects. Of course they did not have any details. Is anybody aware of such a product? We use one of

  • Help configuring Mac Pro for Photoshop CS3

    Hi all, this will be my 1st Mac and I'm hoping to get the proper configuration for using the Mac Pro with Photoshop CS3. Since I'm working with large photos (20" X 24" and even larger) and layers my main concern is speed. The Apple store lists five i