Problem to send out attachment

Hi all,
This is urgent. Any advice is appreciated. I have java class to send out attachement. The program was working fine without any issues until last Friday. Suddenly, it could not send any attachment email out. I was able to send out a simple email without attachment. I did not know what changed. I ran out of resources for troubleshooting it.
Here is my code:
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class SendAttachment {
public void Send (String MailHost, String AddFrom, String AddTo, String FileAttName)
throws Exception {
String host = MailHost;
String from = AddFrom;
String to = AddTo;
String fileAttachment = FileAttName;
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session =
Session.getInstance(props, null);
// Define message
Message message =
new MimeMessage(session);
message.setFrom(
new InternetAddress(from));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject(
"Hello JavaMail Attachment");
// create the message part
BodyPart messageBodyPart =
new MimeBodyPart();
//fill message
messageBodyPart.setText("Hi");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source =
new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(
new DataHandler(source));
messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send( message );
my test program:
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
public class TestJavaMail {
public static void main(String[] args) {
String myhost =args[0];
String from =args[1];
String to = args[2];
String filename = args[3];
try {
System.out.println("Start .....");
System.out.println("Preparing...");
SendAttachment app = new SendAttachment();
app.Send(myhost, from, to, filename);
System.out.println("Success!");
} catch (Exception e) {
//System.err.println(ExceptionUtil.printStackTrace(e));
System.exit(-1);
After successful compilation, here is how I ran the class:
java TestJavaMail mymaihost.com [email protected] [email protected] /tmp/test.txt
It stops just before it calls Transport.send( message );
Any ideas are greatly appreciated.

Hello,
    This could help you.
    http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010
 if the reply help you mark it as your answer.
 Free Managed .NET
Word Component(Create, Modify, Convert & Print)

Similar Messages

  • I have a problems on sending out hotmail email using my ipad

    i hv a ipad 1st generation i set up my hotmail email but i can only rec'd mails cant send out mails thru the acct
    i'm not sure if my setup is correct, pls see below:
    incoming mail:
    host pop3.live.com
    username:
    ssl is on
    port 995
    outgoing mail:
    host stmp.live.com
    ssl is on
    port 587
    <E-mail Edited by Host>

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • Problem in sending Email attachment

    Hi all,
    I am new to Oracle apex. I want to send email in apex with attchment. i have a send email button on clicking of which the following process will be called
    DECLARE
    l_id number;
    fileName varchar2(50);
    v_item blob;
    BEGIN
    apex_mail.send(
    p_to => Receiver email id ,
    p_from => Sender email id,
    p_subj => 'My Subject',
    p_body => 'Test Body',
    apex_mail.push_queue();
    END;
    right now i am able to send email but now dont know how to use -- APEX_MAIL.ADD_ATTACHMENT to send reports as attachments
    Here are some queries related to the parameters in APEX_MAIL.ADD_ATTACHMENT:-
    1) what to send in parameter ' p_attachment '
    2) what to send in parameter ' p_filename'
    3)what to send in parameter ' p_mime_type '
    my requirement is to send the report displayed in the page to be send as attachment with this email. I am quite confused about these parametersto be sent in APEX_MAIL.ADD_ATTACHMENT.
    please provide an example if possible.
    Thanks in Advance
    Anu
    Edited by: user12259335 on Mar 12, 2010 11:55 PM
    Edited by: user12259335 on Mar 13, 2010 1:08 AM

    Hi,
    You need save your report to CLOB if you like send it using APEX_MAIL.ADD_ATTACHMENT.
    You can do that e.g. with xml_spreadsheet
    http://matzberger.de/oracle/spreadsheet-tut-en.html
    Something like this then
    DECLARE
      l_cursor NUMBER := dbms_sql.open_cursor;
      v_clob CLOB;
      l_id NUMBER;
    BEGIN
      l_id := APEX_MAIL.SEND(
        p_to        => '[email protected]',
        p_from      => '[email protected]',
        p_subj      => 'APEX_MAIL with attachment',
        p_body      => 'Please review the attachment.',
        p_body_html => '<b>Please</b> review the attachment'
      dbms_sql.parse(
        l_cursor ,
        'SELECT * FROM emp',
         dbms_sql.native );
      xml_spreadsheet.abfrage(
        p_cursor    => l_cursor ,
        p_file      => v_clob ,
        p_sheetname => 'emp_report'
      APEX_MAIL.ADD_ATTACHMENT(
        p_mail_id   => l_id,
        p_attachment  => v_clob,
        p_filename    => 'emp_report.xml',
        p_mime_type   => 'text/xml'
      APEX_MAIL.PUSH_QUEUE;
      COMMIT;
    END;I did not test that code, but it should work.
    This is just one way to do it.
    Br,Jari

  • Problem in sending the attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi,
    I have a requirement to send the details of an internal table to External mail as an attachment. I have used fn.module 'SO_NEW_DOCUMENT_ATT_SEND_API1' to do so. I am getting the attachment but the data is stored in only one row when we checked it in SAP outbox. This is irrespective of TXT, XLS etc. I can not check the exact file in my external mail inbox as the connection is not established in dev & Quality systems. This question was raised earlier by other guys and there was no correct answer provided. If any of you encountered this type of problem & got the solution please help.
    Thanks,
    Ashok

    Hi Buddy,
        Hope this piece of code will definately help you out, Its working at my end.
    Thanks,
    Krishna..
    FORM p_send_email .
      FIELD-SYMBOLS: <field> TYPE ANY.
      DATA : BEGIN OF i_dload OCCURS 0 ,
             dload(1000) ,
           END OF i_dload .
      DATA: it_receivers LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
              w_object_content LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: w_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
      DATA :w_records TYPE zres_records.
      DATA: w_rsnum(10),
            w_bdmng(14),
            w_meins(4).
      DATA: ws_email LIKE adr6-smtp_addr.  "for internal e_mail address
      DATA: ws_email1 LIKE adr6-smtp_addr. "for external e_mail address
    *--Internal table declaration
      DATA: it_objpack   LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: it_objhead   LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: it_objbin    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: it_objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: it_reclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
      DATA: doc_chng  LIKE sodocchgi1.
      DATA: tab_lines LIKE sy-tabix.
      DATA: w_longtext(500) TYPE c.
      DATA: v_date(10) TYPE c.
      DATA: text(200)  TYPE c.
      DATA: w_text(50) TYPE c.
    *--Get receipient address
      CLEAR it_reclist.
    *--To send error to internal mail
      ws_email = p_email.
    *--To send error to external mail
      ws_email1 = p_email1.
    *---setting name of file for csv
      CONCATENATE text-003 p_bdoc text-004 INTO w_filename.
      CONDENSE w_filename NO-GAPS.
      IF flag <> 1.
        IF p_email1 IS NOT INITIAL.
    build body of message
          CONCATENATE 'disply message ' ' ' INTO it_objtxt
           SEPARATED BY space.
          APPEND it_objtxt.
          CLEAR it_objtxt.
          it_reclist-receiver = ws_email1.
          it_reclist-rec_type = c_u.
          it_reclist-express  = ' '.
          it_reclist-com_type = 'INT'.
          APPEND it_reclist.
    Set title of object and email
          CLEAR: w_text.
         CONCATENATE 'Greenheck Packing List Data'
                            INTO w_text SEPARATED BY space.
          doc_chng-obj_descr = text-005. "w_text.
          doc_chng-obj_name  = 'Inbound EDI'.
          DESCRIBE TABLE it_objtxt LINES tab_lines.
          READ TABLE it_objtxt INDEX tab_lines.
          doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
    *--Move the Report Name as the Heading line for email file
          CLEAR: w_longtext.
    MOVE: text-012 TO w_longtext.
          w_longtext = 'name of report for testing'.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
    *--Append Blank Lines
          APPEND it_objbin. CLEAR it_objbin.
          APPEND it_objbin. CLEAR it_objbin.
    *User name
          CLEAR text.
          MOVE: 'User:' TO text,
                 sy-uname TO text+6.
          it_objbin = text.
          APPEND it_objbin. CLEAR it_objbin.
    ---appending heading to Internal table of Email
          CLEAR: w_longtext, w_xblnr_1 , w_aubel_1,   w_vemng_1,
                 w_matnr_1,  w_harmdesc_1, w_hc_1, w_cooland1_1,
                 w_brgew_1,  w_tknum_1,   w_vbeln_1,  w_vbeln1_1,
                 w_exidv_1,  w_vhilm_1,   w_pack_no_1,
                 w_brgew1_1, w_laeng_1,   w_breit_1,
                 w_hoehe_1,   w_vol_1.
          w_xblnr_1 = 'Cust PO No.'.
          w_aubel_1 = 'Sal Order'.
          w_vemng_1 = 'Pack Qty'.
          w_matnr_1 = 'Model no.'.
          w_harmdesc_1 = 'Hrm Desc'.
          w_hc_1 = 'Hrm Code'.
          w_cooland1_1 = 'Country of Origin'.
          w_brgew_1 = 'Net Wt.'.
          w_tknum_1 = 'Shipment'.
          w_vbeln_1 = 'Billing Doc'.
          w_vbeln1_1 = 'Delivery'.
          w_exidv_1 = 'Pkg ID'.
          w_vhilm_1 = 'Pkg Desc'.
          w_pack_no_1 = 'Pkg No.'.
          w_brgew1_1 = 'Gross Wt'.
          w_laeng_1 = 'Length'.
          w_breit_1 = 'Width'.
          w_hoehe_1 = 'Height'.
          w_vol_1 = 'Cubic Mtr'.
          CONCATENATE w_xblnr_1  w_aubel_1   w_vemng_1
                      w_matnr_1  w_harmdesc_1 w_hc_1   w_cooland1_1
                      w_brgew_1  w_tknum_1   w_vbeln_1  w_vbeln1_1
                      w_exidv_1  w_vhilm_1   w_pack_no_1
                      w_brgew1_1 w_laeng_1   w_breit_1
                      w_hoehe_1   w_vol_1
          INTO w_longtext SEPARATED BY ','.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
          LOOP AT it_tab.
            DO.
              ASSIGN COMPONENT sy-index OF STRUCTURE it_tab TO <field>.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
    Look for Commas in the field value.  If it exists, put quotes around
    value so that the file opens correctly with all the columns aligned
    in Excel.
              SEARCH <field> FOR ',' IN CHARACTER MODE.
    If search for commas was successful.
              IF sy-subrc = 0.
                CONCATENATE '"' <field> '"' INTO <field> IN CHARACTER MODE.
              ENDIF.
              IF sy-index = 1.
                i_dload-dload = <field>.
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
              ELSE.
    Put Comma as a separator for values in IT_DLOAD internal table
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
                CONCATENATE i_dload-dload <field> INTO i_dload-dload
                            SEPARATED BY ',' IN CHARACTER MODE.
              ENDIF.
            ENDDO.
            it_objbin = i_dload-dload.
            APPEND it_objbin. CLEAR it_objbin.
          ENDLOOP.
              flag = 1.
            endif.
        ENDIF.
    ---if to send error file.
        IF p_email IS NOT INITIAL.
    build body of message
          CONCATENATE 'Errors in file ' ' ' INTO it_objtxt
           SEPARATED BY space.
          APPEND it_objtxt.
          CLEAR it_objtxt.
          it_reclist-receiver = ws_email.
          it_reclist-rec_type = c_u.
          it_reclist-express  = ' '.
          it_reclist-com_type = 'INT'.
          APPEND it_reclist.
    Set title of object and email
          CLEAR: w_text.
       CONCATENATE 'Greenheck Packing List Data'
                          INTO w_text SEPARATED BY space.
          doc_chng-obj_descr = text-005.
          doc_chng-obj_name  = 'Inbound EDI'.
          DESCRIBE TABLE it_objtxt LINES tab_lines.
          READ TABLE it_objtxt INDEX tab_lines.
          doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
    *--Move the Report Name as the Heading line for email file
          CLEAR: w_longtext.
    MOVE: text-012 TO w_longtext.
          w_longtext = 'name of report for testing'.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
    *--Append Blank Lines
          APPEND it_objbin. CLEAR it_objbin.
          APPEND it_objbin. CLEAR it_objbin.
    *User name
          CLEAR text.
          MOVE: 'User:' TO text,
                 sy-uname TO text+6.
          it_objbin = text.
          APPEND it_objbin. CLEAR it_objbin.
    ---appending heading to Internal table of Email
          CLEAR: w_longtext, w_xblnr_1 , w_aubel_1,   w_vemng_1,
                 w_matnr_1,  w_harmdesc_1, w_hc_1,  w_cooland1_1,
                 w_brgew_1,  w_tknum_1,   w_vbeln_1,  w_vbeln1_1,
                 w_exidv_1,  w_vhilm_1,   w_pack_no_1,
                 w_brgew1_1, w_laeng_1,   w_breit_1,
                 w_hoehe_1,   w_vol_1, w_error.
          w_xblnr_1 = 'Cust PO No.'.
          w_aubel_1 = 'Sal Order'.
          w_vemng_1 = 'Pack Qty'.
          w_matnr_1 = 'Model no.'.
          w_harmdesc_1 = 'Hrm Desc'.
          w_hc_1 = 'Hrm Code'.
          w_cooland1_1 = 'Counrty of Origin'.
          w_brgew_1 = 'Net Wt.'.
          w_tknum_1 = 'Shipment'.
          w_vbeln_1 = 'Billing doc'.
          w_vbeln1_1 = 'Delivery'.
          w_exidv_1 = 'Pkg ID'.
          w_vhilm_1 = 'Pkg Desc'.
          w_pack_no_1 = 'Pkg No.'.
          w_brgew1_1 = 'Gross Wt'.
          w_laeng_1 = 'Length'.
          w_breit_1 = 'Width'.
          w_hoehe_1 = 'Height'.
          w_vol_1 = 'Cubic Mtr'.
          w_error = 'Error'.
          CONCATENATE w_xblnr_1  w_aubel_1   w_vemng_1
                      w_matnr_1  w_harmdesc_1 w_hc_1  w_cooland1_1
                      w_brgew_1  w_tknum_1   w_vbeln_1  w_vbeln1_1
                      w_exidv_1  w_vhilm_1   w_pack_no_1
                      w_brgew1_1 w_laeng_1   w_breit_1
                      w_hoehe_1   w_vol_1 w_error
          INTO w_longtext SEPARATED BY ','.
          it_objbin = w_longtext.
          APPEND it_objbin. CLEAR it_objbin.
    *--Append the details to Internal table of Email
          LOOP AT it_tab.
            DO.
              ASSIGN COMPONENT sy-index OF STRUCTURE it_tab TO <field>.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
    Look for Commas in the field value.  If it exists, put quotes around
    value so that the file opens correctly with all the columns aligned
    in Excel.
              SEARCH <field> FOR ',' IN CHARACTER MODE.
    If search for commas was successful.
              IF sy-subrc = 0.
                CONCATENATE '"' <field> '"' INTO <field> IN CHARACTER MODE.
              ENDIF.
              IF sy-index = 1.
                i_dload-dload = <field>.
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
              ELSE.
    Put Comma as a separator for values in IT_DLOAD internal table
                SHIFT: i_dload-dload  LEFT DELETING LEADING space.
                CONCATENATE i_dload-dload <field> INTO i_dload-dload
                            SEPARATED BY ',' IN CHARACTER MODE.
              ENDIF.
            ENDDO.
            it_objbin = i_dload-dload.
            APPEND it_objbin. CLEAR it_objbin.
          ENDLOOP.
           flag = 0.
          endif.
    -Convert to correct format----
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = it_objbin
          objcont_new = it_objbin.
    create the control table entry for the main email
      DESCRIBE TABLE it_objtxt LINES tab_lines.
      CLEAR it_objpack-transf_bin.
      it_objpack-head_start = 1.
      it_objpack-head_num   = 0.
      it_objpack-body_start = 1.
      it_objpack-body_num   = tab_lines.
      it_objpack-doc_type   = 'RAW'.
      APPEND it_objpack.
      DESCRIBE TABLE it_objbin LINES tab_lines.
      it_objpack-head_start = 1.
      it_objpack-head_num   = 0.
      it_objpack-body_start = 1.
      it_objpack-body_num   = tab_lines.
      it_objpack-transf_bin = c_x.
      it_objpack-doc_type   = 'CSV'.
      it_objpack-obj_descr  = w_filename. "'billing doc no.csv'.
      it_objpack-obj_name   = 'Billing Doc'.
      it_objpack-doc_size   = tab_lines * 255.
      APPEND it_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_chng
         PUT_IN_OUTBOX              = c_x
          commit_work                = c_x
        TABLES
          packing_list               = it_objpack
         object_header              = it_objhead
          contents_bin               = it_objbin
          contents_txt               = it_objtxt
          receivers                  = it_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc <> 0.
        WRITE: / 'failure in sending mail'.
      ELSE.
         if flag = 0.
           MESSAGE s999(pp) WITH text-007.
         endif.
         if flag = 1.
           MESSAGE s999(pp) WITH text-006.
         endif.
       WRITE: / 'success in sending mail'.
      ENDIF.
        ENDFORM.                    " p_send_email

  • Problem in sending pdf attachment

    hi all
    i am facing a problem when i am sending a pdf attachment in mail... It is showing an errror that the file is not decode properly as it is an email attachment. The below code works fine for other file types. please help me

    FUNCTION ZMAIL_READ.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(SUBJECT) TYPE  SO_OBJ_DES
    *"     VALUE(TEXT) TYPE  STRING
    *"     VALUE(SENDER) TYPE  ADR6-SMTP_ADDR
    *"     VALUE(RECEIVER) TYPE  ADR6-SMTP_ADDR
    *"     VALUE(ATTACHMENTS) TYPE  Z_T_XATTACH OPTIONAL
    *"  EXPORTING
    *"     VALUE(MESSAGE) TYPE  STRING
    DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
          lo_bcs_send_request TYPE REF TO cl_bcs,
          l_send type ADR6-SMTP_ADDR ,
          l_rec type  ADR6-SMTP_ADDR .
    data: it_text type table of soli,
          wa_text type soli.
    DATA: lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
    DATA: lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
    DATA: lv_recipient_uid TYPE uname,
          lv_recipient_mail TYPE adr6-smtp_addr.
    data: lo_message type ref to cx_send_req_bcs value is initial,
          text_val type string.
    data: it_userlist type table of BAPIUSNAME,
          wa_userlist type BAPIUSNAME.
    data: it_selection_range type table of BAPIUSSRGE,
          wa_selection_range type BAPIUSSRGE.
    data: wa_attachment TYPE zxattach,
          attachment_sub type SO_OBJ_DES.
    DATA: xstr type xstring,
          str TYPE string,
          str1 type string,
          it_str2 type table of soli,
          wa_STR2 TYPE SOLI,
    DATA: LOC_CONV TYPE REF TO CL_ABAP_CONV_IN_CE,
          wa_soli type soli,
          it_soli type table of soli,
          it1_solix type solix_tab.
    data result TYPE boolean.
    data: i_ext(10) type c,
          i_type type soodk-objtp.
    wa_text-line = text.
    append wa_text to it_text.
    CLASS cl_bcs DEFINITION LOAD.
    try.
    lo_send_request = cl_bcs=>create_persistent( ).
    catch cx_send_req_bcs.
    endtry.
    * Message body and subject
    data: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    try.
    lo_document = cl_document_bcs=>create_document(
         i_type = 'RAW'
         i_text =  it_text
         i_subject = subject ).
    catch cx_send_req_bcs.
    catch cx_document_bcs.
    catch cx_address_bcs.
    endtry.
    loop at attachments into wa_attachment.
    attachment_sub = wa_attachment-file_name.
    it_str2 = wa_attachment-attach.
    loop at it_str2 into wa_str2.
    str1 = wa_str2-line.
    try.
    CALL FUNCTION 'SSFC_BASE64_DECODE'
      EXPORTING
        B64DATA                        = str1
    *   B64LENG                        =
    *   B_CHECK                        =
      IMPORTING
        BINDATA                        = xstr.
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    try.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        BUFFER                = xstr
       APPEND_TO_TABLE       = 'X'
    * IMPORTING
    *   OUTPUT_LENGTH         =
      TABLES
        BINARY_TAB            = it1_solix
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    endloop.
    try.
    CALL FUNCTION 'SA_KW_RFC_FILENAME_EXT_GET'
      EXPORTING
       AREA            = 'IWBSOLAR'
        MIMETYPE        = wa_attachment-type
    IMPORTING
       EXTENSION       = i_ext
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    i_type = i_ext.
    try.
      lo_document->add_attachment(
      EXPORTING
        i_attachment_type = i_type
        i_attachment_subject = attachment_sub
        i_att_content_hex = it1_solix ).
           CATCH cx_document_bcs.
    endtry.
    endloop.
    try.
    lo_send_request->set_document( lo_document ).
    CATCH cx_send_req_bcs.
    endtry.
    wa_selection_range-PARAMETER = 'address'.
    wa_selection_range-field = 'e_mail'.
    wa_selection_range-sign = 'I'.
    wa_selection_range-option = 'EQ'.
    wa_selection_range-low = receiver.
    append wa_selection_range to it_selection_range.
    try.
    CALL FUNCTION 'BAPI_USER_GETLIST'
    * EXPORTING
    *   MAX_ROWS              = 0
    *   WITH_USERNAME         = ' '
    * IMPORTING
    *   ROWS                  =
    TABLES
        SELECTION_RANGE       = it_selection_range
        USERLIST              = it_userlist.
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    read table it_userlist into wa_userlist index 1.
    try.
      lo_sender = cl_cam_address_bcs=>create_internet_address( sender ).
      lo_send_request->set_sender(
         EXPORTING
         i_sender = lo_sender ).
    catch cx_send_req_bcs.
    catch cx_document_bcs.
    catch cx_address_bcs.
      return.
    endtry.
    try.
        lo_recipient = cl_sapuser_bcs=>create( wa_userlist-USERNAME ).
        lo_send_request->add_recipient(
           EXPORTING
             i_recipient = lo_recipient ).
    *         i_express = 'X' ).
      catch cx_send_req_bcs.
      catch cx_document_bcs.
      catch cx_address_bcs.
    endtry.
    try.
    ** Send email
         LO_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
         lo_send_request->send( EXPORTING
         i_with_error_screen = ' '
         RECEIVING
         result = result ).
         COMMIT WORK.
    CATCH CX_DOCUMENT_BCS.
    CATCH CX_SEND_REQ_BCS INTO lo_message.
    CATCH CX_ADDRESS_BCS.
    text_val = lo_message->IF_MESSAGE~GET_TEXT( ).
    endtry.
    if result = 'X'.
      message = 'E-Mail sent'.
    else.
      message = 'E-Mail not sent'.
    endif.
    ENDFUNCTION.

  • Alignment problem in sending an attachment file as a mail

    Hi,
      My requirement is to send a mail where i have the data in an internal table.
    the .txt attachment file is sent properly no problem in that. But the text inside the file is not alligned properly.
    For eg if i have 5 records in the internal table which iam going to send as an attachment then 5 lines should exist on the attachment file.
    But for me what happens is
    for eg the first two records in the internal table is like as follows.
    record 1 : my name is rose
    record 2 : iam working in SAP ABAP consultant.
    These lines are coming in the attachment file like
    line 1: ame is rose  (some spaces are given then it prints) my  n
    line 2: n SAP ABAP consultant (some spaces are given then it prints) iam working i
    can anyone tell me why this happens . i want the lines to be  displayed as  it is in the internal table.
    can anyone tell how to solve this problem. Thanks...
    Regards,
    rose.

    Hi camila,
    visit this thread
    Alignment in mail body
    regards
    Anup.

  • Problem while sending file attachment

    <strong>Hi,
    I am using java mail api to send mail from a standalone java application. The mail has one html file attachment. I am using the below java program.</strong>
    import java.io.File;
    import java.util.Properties;
    import javax.activation.DataHandler;
    import javax.activation.DataSource;
    import javax.activation.FileDataSource;
    import javax.mail.Authenticator;
    import javax.mail.Message;
    import javax.mail.Multipart;
    import javax.mail.Part;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;
    public class AttachExample {
    public static void main(String args[]) throws Exception {
    String host = "smtp.gmail.com";
    String from = "[email protected]";
    String to = "[email protected]";
    String fileAttachment = "javamail.html";
    // Get system properties
    Properties props = System.getProperties();
    // Setup mail server
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.auth", "true");
    Authenticator authenticator = new Authenticator() {
    public PasswordAuthentication getPasswordAuthentication() {
    String username = "[email protected]";
    String password = "password";
    return new PasswordAuthentication(username, password);
    // Get session
    Session session = Session.getInstance(props, authenticator);
    // Define message
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(
    "[email protected]"));
    message.addRecipient(Message.RecipientType.TO,
    new InternetAddress(from));
    message.setSubject("Hello JavaMail Attachment");
    // create the mail root multipart
    MimeMultipart mpRoot = new MimeMultipart("mixed");
    // Create a body part to house the multipart/alternative Part
    MimeBodyPart contentPartRoot = new MimeBodyPart();
    // Create the content multipart (for text and HTML)
    MimeMultipart mpContent = new MimeMultipart("alternative");
    // Add text
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setText("Hello World");
    mpContent.addBodyPart(mbp1);
    // Add html
    MimeBodyPart mbp2 = new MimeBodyPart();
    mbp2.setContent("<P>Hello World</P>", "text/html");
    mpContent.addBodyPart(mbp2);
    contentPartRoot.setContent(mpContent);
    // Add the root body part to the root multipart
    mpRoot.addBodyPart(contentPartRoot);
    // Add an attachment
    MimeBodyPart mbp3 = new MimeBodyPart();
    DataSource source = new FileDataSource("javamail.html");
    mbp3.setDisposition(Part.ATTACHMENT);
    mbp3.setDataHandler(new DataHandler(source));
    mbp3.setFileName("javamail.html");
    mbp3.setHeader("Content-Type", "text/html");
    mpRoot.addBodyPart(mbp3);
    message.setContent(mpRoot);
    message.saveChanges();
    session.setDebug(true);
    // Send the message
    Transport.send(message);
    <strong>
    In my web mail I am not able to find the attachment in inbox/sent item. However I can see the mail is present there.</strong>
    Here is the mail....
    ------=_Part_0_5439109.
    <div class="ii gt">
    1276373943170
    Content-Type: multipart/alternative; boundary="----=_Part_1_14410104.1276373943174"
    ------=_Part_1_14410104.1276373943174
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    Hello World
    ------=_Part_1_14410104.1276373943174
    Content-Type: text/html; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    <P>Hello World</P>
    ------=_Part_1_14410104.1276373943174--
    ------=_Part_0_5439109.1276373943170
    Content-Type: text/html
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: attachment; filename=javamail.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "<a href="http://www.w3/" target="_blank">http://www.w3</a>=<br />
    .org/TR/REC-html40/loose.dtd">
    <html><head>
    <meta http-equiv=3D"content-type" content=3D"text/html;
    charset=3DISO-8859-1=<br />
    <<.....more html code....>><br />
    </div>
    <hr><br />
    =A9 Vipan Singla 2001<br />
    </body></html><br />
    ------=_Part_0_5439109.
    <div class="ii gt">
    1276373943170--<br />
    <br />
    <br />
    <strong>I think I am missing something. Please suggest if you have any idea.<br />
    Thanks In Advance.</strong><br />
    <br />
    <br />
    </div>

    Your posting is full of html markup that this forum doesn't understand, which makes
    it really hard to see what you were trying to say...
    Also, I can't tell whether you're showing us the entire message that was sent,
    or whether you're just showing us part of it. For example, I don't see any From
    or To headers in the message. If they're really missing, something else is wrong.
    If they actually are present in the message, then the rest of what you showed
    looks fine.
    Possibly your web mail isn't able to handle a message that has both a
    multipart/alternative and an attachment? Try a simple plain text message
    with an attachment and see if that works better.

  • Problem in sending Excel attachment on the SAI id.

    Hi Experts.
    i am using one function module to send one alv output in Excel format to sapid.
    FORM SEND_MAIL TABLES T_AMS RECEIVERS_TAB.
    CALL FUNCTION 'Z_MAIL_ITAB_AS_XLS_ATTACHMENT'
               EXPORTING
                    I_MESSAGE_TITLE       = SYST-TITLE
                    I_ATTACHMENT_TITLE    = SYST-TITLE
                    I_STRUCTURE_NAME      = 'ZAMT__ZBCAUTH0001'
                    I_INCLUDE_HEADER      = 'X'
                 I_RECIPIENT_UNAME     = P_UNAME
               TABLES
                    T_MESSAGE             = MESSAGE_TAB
                    T_DATA                = I_TABLE
                    T_RECEIVERS           = RECEIVERS_TAB
               EXCEPTIONS
                    NO_DATA_TO_SEND       = 01
                    UNABLE_TO_GET_NAMETAB = 02
                    UNABLE_TO_GET_DDTEXTS = 03
                    NO_HEADER_SUPPLIED    = 04
                    MAIL_SENDING_FAILED   = 05
                    OTHERS                = 06.
      IF SYST-SUBRC NE 0.
        MESSAGE ID SYST-MSGID TYPE SYST-MSGTY NUMBER SYST-MSGNO
        WITH SYST-MSGV1 SYST-MSGV2 SYST-MSGV3 SYST-MSGV4.
      ENDIF.
    ENDFORM.
    now, my requirement is i had two internal table one for  ITAB_FICO & ITAB_SD for FICO and SD module.AND BY CHECKING CONDITON I HAD TO SEND MAIL TO CORRESPONDING DIFFERENT PERSON.
    I HAD DONE THE CODING AS GIVEN BELOW.
    IF NOT itab_fico[] IS INITIAL.
    RECEIVERS_TAB-RECEIVER = 'SAP_00021'.
        RECEIVERS_TAB-REC_TYPE = 'B'.
        RECEIVERS_TAB-EXPRESS = 'X'.
        APPEND RECEIVERS_TAB.
                 PERFORM SEND_MAIL TABLES T_AMS RECEIVERS_TAB.
    endif.
    IF NOT itab_sd[] IS INITIAL.
    RECEIVERS_TAB-RECEIVER = 'SAP_00022'.     <------- its my sap id
        RECEIVERS_TAB-REC_TYPE = 'B'.
        RECEIVERS_TAB-EXPRESS = 'X'.
        APPEND RECEIVERS_TAB.
                PERFORM SEND_MAIL TABLES T_AMS RECEIVERS_TAB.
    endif.
    Now, what is happening is  i am getting two mails,
    one contains the attachement in Excel for ITAB_FICO. ( 3 ROWS)
    SECOND mail contains two attachement one for ITAB_FICO ,second attachment contains the line items of ITAB_FICO + in the same excel the line items of ITAB_SD(2 ROWS).
    So, for one time its working fine, but on sending mail second or third them its attaching the previous attachment also...... i tried to refresh everything but its not working....................
    please help,,,,or if possible tell me some other SAP  FM ...which can fulfil the requirements.
    I will reward points for every suggestion.
    thanks

    Hi Saurabh,
    IF NOT itab_fico[] IS INITIAL.
    <b>REFRESH : RECEIVERS_TAB.
    CLEAR : RECEIVERS_TAB.</b>
    RECEIVERS_TAB-RECEIVER = 'SAP_00021'.
    RECEIVERS_TAB-REC_TYPE = 'B'.
    RECEIVERS_TAB-EXPRESS = 'X'.
    APPEND RECEIVERS_TAB.
    PERFORM SEND_MAIL TABLES T_AMS RECEIVERS_TAB.
    endif.
    IF NOT itab_sd[] IS INITIAL.
    <b>REFRESH : RECEIVERS_TAB.
    CLEAR : RECEIVERS_TAB.</b>
    RECEIVERS_TAB-RECEIVER = 'SAP_00022'. <------- its my sap id
    RECEIVERS_TAB-REC_TYPE = 'B'.
    RECEIVERS_TAB-EXPRESS = 'X'.
    APPEND RECEIVERS_TAB.
    PERFORM SEND_MAIL TABLES T_AMS RECEIVERS_TAB.
    endif.
    Best regards,
    Prashant

  • I send out emails with proper grammar.  People would reply returning my email and I would notice the grammar has changed and doesn't make sense.  What's causing this problem?

    I send out emails with proper grammar.  People would reply returning my email and I would notice the grammar has changed and doesn't make sense.  What's causing this problem?

    Have you actually compared what you sent (in your Sent Mail Folder) with what is in the reply?
    Note that Auto Correction can often change what you think that you are typing.
    Are you sure that the return message has your original message intact and not edited by the recipient?
    Bottom line: if the recipient does a simple reply to your message with the original message attached the system is not going to edit your message.

  • Problem in sending attachment using "SO_NEW_DOCUMENT_ATT_SEND_API1"

    Hi All,
    I have a requirement of sending the data available in an internal table via email. I need to populate this content into excel sheet and send it as an attachment to recipients. I am using the following code for that.
    REPORT  z51515t_doc_att.
    DATA: objpack   LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: objhead   LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    DATA: doc_chng  LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    DATA : BEGIN OF itab OCCURS 0,
              pernr LIKE p0001-pernr,
              name LIKE p0002-vorna,
           END OF itab.
    Creation of the document to be sent
    File Name
    doc_chng-obj_name = 'SENDFILE'.
    Mail Subject
    doc_chng-obj_descr = 'Delivered Mail'.
    Mail Contents
    objtxt = 'My Content 1 '.
    APPEND objtxt.
    objtxt = 'My Content2'.
    APPEND objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    Creation of the entry for the document
    CLEAR objpack-transf_bin. "Will get content from content_text
    objpack-head_start = 1. "Reads given row number in object header
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'RAW'.
    APPEND objpack.
    Prepare content for attachment
    DO 3 TIMES.
      itab-pernr = 182.
      itab-name = 'Prasath'.
      APPEND itab.
      itab-pernr = 1000.
      itab-name = 'Praveen'.
      APPEND itab.
    ENDDO.
    Populate attachment content
    LOOP AT itab.
      CONCATENATE itab-pernr itab-name INTO objbin-line.
      APPEND objbin.
    ENDLOOP.
    DESCRIBE TABLE objbin LINES tab_lines.
    Creation of the entry for the compressed attachment
    objpack-transf_bin = 'X'. "Will get content from content_bin
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'EXT'.
    objpack-obj_name   = 'WEBSITE'.
    objpack-obj_descr  = 'MyFile.XLS'.
    objpack-doc_size   = tab_lines * 255.
    APPEND objpack.
    target recipent
    CLEAR reclist.
    reclist-receiver = '[email protected]'.
    reclist-express  = 'X'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    copy recipents
    CLEAR reclist.
    reclist-receiver = '[email protected]'.
    reclist-express  = 'X'.
    reclist-rec_type = 'U'.
    reclist-copy     = 'X'.
    APPEND reclist.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
        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.
    Now using this code i am able to send out the file but the data in the XL file is not aligned properly. When i open the attachment that i receive the contents of itab appear inside the same cell - A1 of the XL sheet. I want the data to be available in different rows and columns. How do i achieve this?
    Thanks,
    Prasath N

    See the below program it was sending the file   as  attach in XLS  format   by  column and rows  are  properly placed ...  see the
    <b>Code  in my program  :
    CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode</b>
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
    *   Retrieve sample data from table ekpo
      PERFORM data_retrieval.
    *   Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    * Populate message body text
      perform populate_email_message_body.
    * Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
    *   Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
    *       Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    *    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    *    con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    * Populate zerror return code
      ld_error = sy-subrc.
    * Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
    *       Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
    *        Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY
    reward  points  if it is usefull ....
    Girish

  • I have an Ipad 2 and are having problems sending out emails in one of my email address. I always get a message reading the email was not sent because the server does not allow relaying. This is an email account POP3. I have no such problem with gmail.

    I have an Ipad 2 and are having problems sending out emails in one of my email address. This is a POP3 email Account? I always get a message reading that the email was not sent because the server does not allow relaying. I have no such problem with gmail. What could be the problem and how do I resolve this. Is it about settings?
    Richard.

    Welcome to the Apple community.
    If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact Apple ID Support, upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
    The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
    The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
    Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
    Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
    Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do.

  • I work for a retailer who sends out e-receipts as pdf attachements.  When the email arrives on any apple product, i see the email with the paperclip icon showing that there is an attachment but i cannot ever see or find the actual attachment.  Any ideas?

    i work for a retailer who sends out e-receipts as pdf attachements.  When the email arrives on any apple product, i see the email with the paperclip icon showing that there is an attachment but i cannot ever see or find the actual attachment.  Any ideas?

    i have scrolled left, right, up and down on iphone4, iphone5 and ipad and the attachment simply does not exist.  It has to be something with the apple mail client setup because for any mail client, if they go to the webemail thru safari, the attachment is there and it can be viewed without issue.
    I know there are plenty of people out there with this issue with the mail clients set up that you access thru the email icon on the iphone and ipad but i cannot find anyone with a resolution.  I cannot find any settings in the mail client setup that has anything to do with attachments or for what attachments can or cannot be read or seen.
    Hopefully someone out there has figured something out because this is an odd one.

  • Problem sending out email on iPhone 3GS

    Hi,
    I'm having problem sending email on my iPhone 3GS today only. Error "Cannot send Mail: an error occurred while delivering this message." WiFi is off; Turn on all the SMTP to Yahoo and Gmail; I have powered it off and on again, still my email are not sending out.
    Help...~

    Ya - I am have the same problem. I have 4 accounts that are set-up on my phone. 3 Gmail - I can receive but not send out replies - all settings are matched up with gmail sever information. I have 1 Yahoo account which I can send and receive from no problem. Why??

  • Problem in sending attachment mail

    hi all
    i am using function module "SO_NEW_DOCUMENT_ATT_SEND_API1"
    i am facing problem in sending attachment .....if width of my text line is more than 255.
    pls guide me how to proceed further

    Hi,
    See this thread.
    Re: How to email an attachment with more than 255 characters?
    Hope it help you.
    Regards,
    Lijo Joseph

  • Has anyone had a problem with Draft Emails getting sent with Mac OS 10.8.2? It just happened to me and sent a few drafts out to a potential employer I planned on sending out torrow.

    Has anyone had a problem with Draft Emails getting sent with Mac OS 10.8.2? It just happened to me and sent a few drafts out to a potential employer I planned on sending out tomorrow.

    Hi, one question & one suggestion...
    What possible things are connected at home but not at the store, inlude every cable, etc.
    One way to test is to Safe Boot from the HD, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, Test for problem in Safe Mode...
    PS. Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive
    Reboot, test again.
    If it only does it in Regular Boot, then it could be some hardware problem like Video card, (Quartz is turned off in Safe Mode), or Airport, or some USB or Firewire device, or 3rd party add-on, Check System Preferences>Accounts>Login Items window to see if it or something relevant is listed.
    Check the System Preferences>Other Row, for 3rd party Pref Panes.
    Also look in these if they exist, some are invisible...
    /private/var/run/StartupItems
    /Library/StartupItems
    /System/Library/StartupItems
    /System/Library/LaunchDaemons
    /Library/LaunchDaemons

Maybe you are looking for