How to send an email with an attachment to the customers email address.

Hi friends,
How to send an email with an attachment to the customers email address.
the attachment will be in doc format.
Having an Header
the data which i am sending must be in a TABLE format
with 5 columns.
and each column must have a column heading
Please guide me.
Thanks in Advance,
Ganesh.

*& Report  ZEMAIL_ATTACH                                               *
*& Example of sending external email via SAPCONNECT                    *
REPORT  ZEMAIL_ATTACH                   .
TABLES: ekko.
PARAMETERS: p_email   TYPE somlreci1-receiver .
*Here get the values of mail from the table adn6 for the customer address.
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'
                                      'DOC'
                                      '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
regards,
venkat.

Similar Messages

  • How to send e-mail with an attachment from remote database server.???

    Hi All,
    I have tried the simple mail sending and with the attachment using UTL_SMTP. But the problem is , it is sending the mail with attachment of the file name i give, it takes and creates that file and sends as attachment not from the actual file location. I am trying to attach the file which i stored in remote database server.
    The following code I tried. But not worked for attachment
    DECLARE
       v_From       VARCHAR2(80) := '[email protected]';
       v_Recipient  VARCHAR2(80) := '[email protected]';
       v_Subject    VARCHAR2(80) := 'test subject';
       v_Mail_Host  VARCHAR2(30) := 'pop3.somedomain.com';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
    BEGIN
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Data(v_Mail_Conn,
        'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
        'From: '   || v_From || crlf ||
        'Subject: '|| v_Subject || crlf ||
        'To: '     || v_Recipient || crlf ||
        'MIME-Version: 1.0'|| crlf ||     -- Use MIME mail standard
        'Content-Type: multipart/mixed;'|| crlf ||
        ' boundary="-----SECBOUND"'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/html;'|| crlf ||
        'Content-Transfer_Encoding: 7bit'|| crlf ||
        crlf ||
        'some message text'|| crlf ||     -- Message body
        'more message text'|| crlf ||
        crlf ||
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/html;'|| crlf ||
        ' name="Fund Authorization report"'|| crlf ||
        'Content-Transfer_Encoding: 8bit'|| crlf ||
        'Content-Disposition: attachment;'|| crlf ||
        ' filename="/usr/tmp/Test.html"'|| crlf ||
        crlf ||
        'HTML Attachment'|| crlf ||     -- Content of attachment
        crlf ||
        '-------SECBOUND--'               -- End MIME mail
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;How can I attach a file which is stored in database server and send it in a mail.
    Please someone help me in this.
    Thanks,
    Alaka.

    Try this code
    Regards Salim.
    CREATE OR REPLACE TRIGGER EmailOnServerErr AFTER SERVERERROR ON DATABASE
    DECLARE
       mail_conn       UTL_SMTP.connection;
       crlf            VARCHAR2(2) := chr(13)||chr(10);
       msg             VARCHAR2(32760);
       sid_name        VARCHAR2(16);
       bdump_dest      VARCHAR2(128);
       smtp_relay      VARCHAR2(32) := 'MyMailRelay';
       recipient_address  VARCHAR2(64) := '[email protected]';
       sender_address     VARCHAR2(64) := '[email protected]';
       mail_port       NUMBER := 25;
       log_file_handle UTL_FILE.FILE_TYPE;
       log_file_dir    VARCHAR2(256) := 'ERR_LOG_DIR';
       log_file_name   VARCHAR2(256) := 'OracleErrors.log';
       maxlinesize     NUMBER := 32767;
       session_rec     sys.v_$session%ROWTYPE;
       audit_rec       sys.dba_audit_trail%ROWTYPE;
       auditing        BOOLEAN;
       LinesOfSQL      BINARY_INTEGER;
       offending_sql   DBMS_STANDARD.ora_name_list_t;
       CURSOR bdump_cur IS
          SELECT TRIM(value)
          FROM v$parameter
          WHERE name = 'background_dump_dest'
       CURSOR sid_cur IS
          SELECT TRIM(instance_name)
          FROM v$instance
       CURSOR session_cur IS
          SELECT s.*
          FROM v$session s
          WHERE s.sid = dbms_support.mysid
       CURSOR audit_trail_cur(AUDSID IN NUMBER) IS
          SELECT *
          FROM dba_audit_trail
          WHERE sessionid = AUDSID
    BEGIN
       IF (USER = 'SYSTEM' OR USER = 'SYS') THEN
          -- Ignore this error
          NULL;
       ELSIF IS_SERVERERROR (1034) THEN
          -- Ignore this error
          NULL;
       ELSE
          -- get the sid
          OPEN sid_cur;
          FETCH sid_cur INTO sid_name;
          CLOSE sid_cur;
          -- get the location of the alert log
          OPEN bdump_cur;
          FETCH bdump_cur INTO bdump_dest;
          CLOSE bdump_cur;
          -- get the session information
          OPEN session_cur;
          FETCH session_cur INTO session_rec;
          CLOSE session_cur;
          -- get the audit_trail information if it exists
          OPEN audit_trail_cur(session_rec.audsid);
          FETCH audit_trail_cur INTO audit_rec;
          auditing := audit_trail_cur%FOUND;
          CLOSE audit_trail_cur;
          IF session_rec.program = 'MyProgram.exe' THEN
             NULL;  -- ignore actions from MyProgram - that's where I do maintenance
          ELSE
             -- compose the message
             msg := 'Subject: Oracle error '||' on '||sid_name||crlf;
             msg := msg||'To: '||recipient_address||crlf;
             msg := msg||'For more information see the alert log file located at:'||crlf;
             msg := msg||bdump_dest||'/alert_'||sid_name||'.log'||crlf;
             msg := msg||'or the error log file: $'||log_file_dir||'/'||log_file_name||crlf;
             msg := msg||'Error Time='||TO_CHAR(SYSDATE,'DD-Mon-YYYY HH24:MI:SS')||crlf;
             msg := msg||DBMS_UTILITY.FORMAT_CALL_STACK||crlf;
             LinesOfSQL := sql_txt(offending_sql);
             msg := msg||'Offending SQL is:'||crlf;
             FOR loop_counter IN offending_sql.FIRST..offending_sql.LAST
             LOOP
                msg := msg||offending_sql(loop_counter);
             END LOOP;
             msg := msg||crlf||'----- PL/SQL Error Stack -----'||crlf;
             msg := msg||DBMS_UTILITY.FORMAT_ERROR_STACK||crlf;
             msg := msg||'V$SESSION.SADDR='   ||session_rec.saddr   ||crlf;
             msg := msg||'V$SESSION.SID='     ||session_rec.sid     ||crlf;
             msg := msg||'V$SESSION.SERIAL#=' ||session_rec.serial# ||crlf;
             msg := msg||'V$SESSION.AUDSID='  ||session_rec.audsid  ||crlf;
             msg := msg||'V$SESSION.PADDR='   ||session_rec.paddr   ||crlf;
             msg := msg||'V$SESSION.USER#='   ||session_rec.user#   ||crlf;
             msg := msg||'V$SESSION.USERNAME='||session_rec.username||crlf;
             msg := msg||'V$SESSION.COMMAND=' ||session_rec.command ||crlf;
             msg := msg||'V$SESSION.OWNERID=' ||session_rec.ownerid ||crlf;
             msg := msg||'V$SESSION.TADDR='   ||NVL(session_rec.taddr   ,'Null')||crlf;
             msg := msg||'V$SESSION.LOCKWAIT='||NVL(session_rec.lockwait,'Null')||crlf;
             msg := msg||'V$SESSION.STATUS='  ||NVL(session_rec.status  ,'Null')||crlf;
             msg := msg||'V$SESSION.SERVER='  ||NVL(session_rec.server  ,'Null')||crlf;
             msg := msg||'V$SESSION.SCHEMA#=' ||session_rec.schema#||crlf;
             msg := msg||'V$SESSION.SCHEMANAME=' ||NVL(session_rec.schemaname,'Null')||crlf;
             msg := msg||'V$SESSION.OSUSER='     ||NVL(session_rec.osuser    ,'Null')||crlf;
             msg := msg||'V$SESSION.PROCESS='    ||NVL(session_rec.process   ,'Null')||crlf;
             msg := msg||'V$SESSION.MACHINE='    ||NVL(session_rec.machine   ,'Null')||crlf;
             msg := msg||'V$SESSION.TERMINAL='   ||NVL(session_rec.terminal  ,'Null')||crlf;
             msg := msg||'V$SESSION.PROGRAM='    ||NVL(session_rec.program   ,'Null')||crlf;
             msg := msg||'V$SESSION.TYPE='       ||NVL(session_rec.type      ,'Null')||crlf;
             msg := msg||'V$SESSION.SQL_ADDRESS='    ||session_rec.sql_address  ||crlf;
             msg := msg||'V$SESSION.SQL_HASH_VALUE=' ||NVL(TO_CHAR(session_rec.sql_hash_value) ,'Null')||crlf;
             msg := msg||'V$SESSION.PREV_SQL_ADDR='  ||session_rec.prev_sql_addr||crlf;
             msg := msg||'V$SESSION.PREV_HASH_VALUE='||NVL(TO_CHAR(session_rec.prev_hash_value),'Null')||crlf;
             msg := msg||'V$SESSION.MODULE='     ||NVL(session_rec.module              ,'Null')||crlf;
             msg := msg||'V$SESSION.MODULE_HASH='||NVL(TO_CHAR(session_rec.module_hash),'Null')||crlf;
             msg := msg||'V$SESSION.ACTION='     ||NVL(session_rec.action              ,'Null')||crlf;
             msg := msg||'V$SESSION.ACTION_HASH='||NVL(TO_CHAR(session_rec.action_hash),'Null')||crlf;
             msg := msg||'V$SESSION.CLIENT_INFO='||NVL(session_rec.client_info         ,'Null')||crlf;
             msg := msg||'V$SESSION.FIXED_TABLE_SEQUENCE='||NVL(TO_CHAR(session_rec.fixed_table_sequence),'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_OBJ#='  ||NVL(TO_CHAR(session_rec.row_wait_obj#)  ,'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_FILE#=' ||NVL(TO_CHAR(session_rec.row_wait_file#) ,'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_BLOCK#='||NVL(TO_CHAR(session_rec.row_wait_block#),'Null')||crlf;
             msg := msg||'V$SESSION.ROW_WAIT_ROW#='  ||NVL(TO_CHAR(session_rec.row_wait_row#)  ,'Null')||crlf;
             msg := msg||'V$SESSION.LOGON_TIME='     ||NVL(TO_CHAR(session_rec.logon_time,'DD-Mon-YYYY HH24:MI:SS'),'Null')||crlf;
             msg := msg||'V$SESSION.LAST_CALL_ET='   ||NVL(TO_CHAR(session_rec.last_call_et)   ,'Null')||crlf;
             msg := msg||'V$SESSION.PDML_ENABLED='   ||NVL(session_rec.pdml_enabled   ,'Null')||crlf;
             msg := msg||'V$SESSION.FAILOVER_TYPE='  ||NVL(session_rec.failover_type  ,'Null')||crlf;
             msg := msg||'V$SESSION.FAILOVER_METHOD='||NVL(session_rec.failover_method,'Null')||crlf;
             msg := msg||'V$SESSION.FAILED_OVER='    ||NVL(session_rec.failed_over    ,'Null')||crlf;
             msg := msg||'V$SESSION.RESOURCE_CONSUMER_GROUP='||NVL(session_rec.resource_consumer_group,'Null')||crlf;
             msg := msg||'V$SESSION.PDML_STATUS='    ||NVL(session_rec.pdml_status    ,'Null')||crlf;
             msg := msg||'V$SESSION.PDDL_STATUS='    ||NVL(session_rec.pddl_status    ,'Null')||crlf;
             msg := msg||'V$SESSION.PQ_STATUS='      ||NVL(session_rec.pq_status      ,'Null')||crlf;
             IF auditing THEN
                msg := msg||'DBA_AUDIT_TRAIL.OS_USERNAME='  ||NVL(audit_rec.os_username,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.USERNAME='     ||NVL(audit_rec.username   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.USERHOST='     ||NVL(audit_rec.userhost   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.TERMINAL='     ||NVL(audit_rec.terminal   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.TIMESTAMP='    ||TO_CHAR(audit_rec.timestamp,'DD-Mon-YYYY HH24:MI:SS')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OWNER='        ||NVL(audit_rec.owner      ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OBJ_NAME='     ||NVL(audit_rec.obj_name   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ACTION='       ||audit_rec.action   ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ACTION_NAME='  ||NVL(audit_rec.action_name   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.NEW_OWNER='    ||NVL(audit_rec.new_owner     ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.NEW_NAME='     ||NVL(audit_rec.new_name      ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.OBJ_PRIVILEGE='||NVL(audit_rec.obj_privilege ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SYS_PRIVILEGE='||NVL(audit_rec.sys_privilege ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ADMIN_OPTION=' ||NVL(audit_rec.admin_option  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.GRANTEE='      ||NVL(audit_rec.grantee       ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.AUDIT_OPTION=' ||NVL(audit_rec.audit_option  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SES_ACTIONS='  ||NVL(audit_rec.ses_actions   ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_TIME='  ||NVL(TO_CHAR(audit_rec.logoff_time)  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_LREAD=' ||NVL(TO_CHAR(audit_rec.logoff_lread) ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_PREAD=' ||NVL(TO_CHAR(audit_rec.logoff_pread) ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_LWRITE='||NVL(TO_CHAR(audit_rec.logoff_lwrite),'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.LOGOFF_DLOCK=' ||NVL(audit_rec.logoff_dlock  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.COMMENT_TEXT=' ||NVL(audit_rec.comment_text  ,'Null')||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.SESSIONID='    ||audit_rec.sessionid   ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.ENTRYID='      ||audit_rec.entryid     ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.STATEMENTID='  ||audit_rec.statementid ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.RETURNCODE='   ||audit_rec.returncode  ||crlf;
                msg := msg||'DBA_AUDIT_TRAIL.PRIV_USED='    ||NVL(audit_rec.priv_used,'Null')||crlf;
             END IF;
             msg := msg||'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-'||crlf||crlf;
             -- write the message to the error log file
             log_file_handle := UTL_FILE.FOPEN (log_file_dir, log_file_name, 'A',maxlinesize);
             UTL_FILE.PUT_LINE(log_file_handle,msg);
             UTL_FILE.FCLOSE(log_file_handle);
             -- send the message by Email
             mail_conn := UTL_SMTP.open_connection(smtp_relay, mail_port);
             UTL_SMTP.HELO(mail_conn, smtp_relay);
             UTL_SMTP.MAIL(mail_conn, sender_address);
             UTL_SMTP.RCPT(mail_conn, recipient_address);
             UTL_SMTP.DATA(mail_conn, msg);
             UTL_SMTP.QUIT(mail_conn);
          END IF; -- client_program = MyProgram.exe
       END IF;
    END;
    /

  • How to send a mail with PDF attachment

    Hello
    Good Day!
    We have a requirement to send the mail with pdf attachment. Pdf file will be remain same for all mails and it will be placed at server. We are on R12.4 and below is the database information :
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    Thanks a ton for your anticipated help!
    Thanks
    Gaurav

    The word URGENT is considered as rude in this forum.. Nobody here is getting paid for the ansers they are giving..
    Just have a look at These threads.Those will help you.

  • How to send Java Mail with EXCEL attachment?

    I tried the following:
    ByteArrayDataSource bs = new ByteArrayDataSource (is, "application/excel");
    as my datasource (all other apis are fine)
    But when I send this message with this datasource as attachment,I get a ParseException with the VM complaining about malformed headers.
    Please help

    Exactly when do you get the ParseException, and what's the message
    with the exception?
    BTW, "application/excel" is not the correct MIME type for Microsoft Office
    Excel files. The correct MIME type is "application/vnd.ms-excel".
    http://www.iana.org/assignments/media-types/application/vnd.ms-excel

  • How to send error message via a mail to the customers email id

    HI experts ,
    i have a requirement,In idoc where i have to send the error message via email to a perticular emailid?
    please help me n tell also which fm is used for that?
    Thanks
    RAhul Sisodia

    Hi ,
    Check this Link..
    [sending an email with multiple attachments;
    Regards,
    Sachin M M

  • How to send a mail as an attachment in a mail with AppleScript?

    Hi,
    I want to manage my spam using the advices found in support.apple website :
    OS X Mail
    Open the message and choose “Forward as Attachment” from the Message menu.
    Forward the message to iCloud [email protected].
    Forward the message again to abuse@domain, replacing domain with the part of the sender's email address after the @ symbol. For example, if the sender's email address is [email protected], forward the message to [email protected].
    I don't know how to make a message as an attachment...
    set theAttachment to theMessage
    make new attachment with properties {file name:theAttachment} at after last paragraph
    Here is my whole script, if it runs, it could be useful :
    tell application "Mail"
      -- envoi les messages sélectionnés en PJ à [email protected]
              set theMessages to the selection
              repeat with theMessage in theMessages
                        set theAttachment to theMessage
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
      make new to recipient with properties {address:"[email protected]"}
                                  tell content of theMessage
      make new attachment with properties {file name:theAttachment} at after last paragraph
                                  end tell
                        end tell
      send newMessage
              end repeat
      -- envoi les messages sélectionnés en PJ à abuse@<domaine du spammeur>
              set theMessages to the selection
              repeat with theMessage in theMessages
                        set theAttachment to theMessage
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
                                  set theSpamAddress to theMessage's sender
                                  set AppleScript's text item delimiters to {"@"}
                                  set spamerDomainName to text item 2 of theSpamAddress
                                  set theNewSpamAddress to "abuse@" & spamerDomainName
      make new to recipient with properties {address:theNewSpamAddress}
                                  tell content of theMessage
      make new attachment with properties {file name:theAttachment} at after last paragraph
                                  end tell
                        end tell
      send newMessage
              end repeat
    end tell
    Thank you!

    Perfect!
    You clearly give me the way. Actually I have used the AppleScript Language Guide from https://developer.apple.com to finalize my AppleScript.
    You just need to select the spam message(s) in "Mail" application, then run the script.
    As I mentionned previously, it just do this automatically :
    OS X Mail
    Open the message and choose “Forward as Attachment” from the Message menu.
    Forward the message to iCloud [email protected].
    Forward the message again to abuse@domain, replacing domain with the part of the sender's email address after the @ symbol. For example, if the sender's email address is [email protected], forward the message to [email protected].
    Here is the entire working script :
    -- Ce script permet de lutter contre le spam.
    -- Je me suis appuyé sur les conseils sur http://support.apple.com/kb/TS4019?viewlocale=fr_FR
    tell application "Mail"
              set theMessages to the selection
              repeat with theMessage in theMessages
      -- enregistre le message dans un fichier pour le mettre en PJ ensuite
                        set msgContent to source of theMessage
                        set tmpFile to ((path to desktop) as rich text) & "ForwardedMessage"
                        set referenceNumber to open for access tmpFile with write permission
      write msgContent to referenceNumber
      close access referenceNumber
      -- envoi le message sélectionné en PJ à [email protected]
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
      make new to recipient with properties {address:"[email protected]"}
                                  tell content of newMessage
      make new attachment with properties {file name:tmpFile} at after last paragraph
                                  end tell
                        end tell
      send newMessage
      -- envoi le message sélectionné en PJ à abuse@<domaine du spammeur>
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
                                  set theSpamAddress to theMessage's sender
                                  set AppleScript's text item delimiters to {"@"}
                                  set theSpamAddress to text item 2 of theSpamAddress
                                  set AppleScript's text item delimiters to {">"}
                                  set spamerDomainName to text item 1 of theSpamAddress
                                  set theNewSpamAddress to "abuse@" & spamerDomainName
      make new to recipient with properties {address:theNewSpamAddress}
                                  tell content of newMessage
      make new attachment with properties {file name:tmpFile} at after last paragraph
                                  end tell
                        end tell
      send newMessage
              end repeat
    end tell

  • HOW TO SEND PERSONALIZED EMAILS (WITH SAME MESSAGE) TO ALL ADDRESSES IN THE ADDRESS BOOK - WITH RECIPIENTS SEEING ONLY THEIR NAME BUT NOT WHO ELSE IS GETTING IT

    HOW TO SEND PERSONALIZED EMAILS WITH THE SAME MESSAGE, BUT WITH THE INDIVIDUAL RECIPIENT'S NAME... (OR NAME AND THE EMAIL ADDRESS) TO ALL ADDRESSES IN THE ADDRESS BOOK - WITH RECIPIENTS SEEING ONLY THEIR OWN NAME WITHIN THE BODY OF THE MESSAGE TO THEM ?
    ALSO, HOW TO ELIMINATE ALL THE OTHER NAMES FROM THE LIST - SO THEY CAN NOT SEE WHO ELSE IS ON THE MAILING LIST, AND WHO ELSE IS GETTING THE SAME MESSAGE?

    In the csv file, the column headers must match the the special references in curly brackets.
    So you either change the column header in .csv file or the bit in the curly brackets in the Template email.
    To change the column header:
    In the example shown below, I wanted to use the first two columns
    'First Name', 'Last Name' note the exact spelling.
    I also wanted the email address which was in a column called 'Primary Email'.
    To make it easier for me, I copied the Primary Email column and inserted it into the third column position and then changed the column header name from 'Primary Email' to 'Email'. (This meant I still had the original column header just in case). see image below.
    But you could just change the column header name from 'Primary Email' to 'Email' without moving column about - up to you.
    At this point check that all the contacts do have a valid email address.
    then save the file.
    If you do not want to edit the .csv file, then you need to edit the template email.
    eg: {{First Name}} {{Last Name}} <{{Email}}>
    change to : {{First Name}} {{Last Name}} <{{Primary Email}}>
    If still having an issue, please post two images.
    One image needs to show the row of column headers used in .csv file.
    The other image needs to show the Template email, so I can see how you have used the curly brackets.

  • I keep getting "undelivered mail returned to sender" that comes with an attachment. I have not opened the attachment but the email returned is usually from people that i have not emailed in a long time.

    I keep getting "undelivered mail returned to sender" that comes with an attachment. i do not open the attachment but i get email returned from people that i have not emailed in years. I also have current people that tell me they receive email from me and there is nothing on the email and it is a repetative thing for them and for me. I have scanned my computer and it keeps telling me there are no viruses but i keep getting these emails. can anyone help me please!

    Someone is probably sending spam with your address forged on the To: line.  Could be one of your old contacts with a Windows machine has a virus that's doing it.  It's also possible your e-mail account has been hacked, though I'd think such a hacker would be a bit more purposeful.
    For more information, see:
    http://www.reedcorner.net/guides/macvirus/is_it_malware.php#spam
    * Disclaimer: links to my pages may give me compensation, and should not be taken as endorsement of my services by Apple.

  • How to send automatic mail and put attache file on batch file ?

    how to send automatic mail and put attache file on batch file ?
    START MAILTO:[email protected]?SUBJECT=PHONE%CALL^&BODY=Testing

    Hi,
    Do you want to use a batch file to create new email message (including recipients, subject and email body) with attachments? If so, I'd recommend you post your question in the Scripting Guys forum for further assistance:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Please feel free to let me know if I've misunderstood something.
    Regards,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to send any text as soap attachment without SAAJ ?

    I have to send XML or text file as an attachment in the web service, just like email attachment. Currently I am intercepting the SOAP message (sent from web service client) and then adding an attachment using SAAJ. Can we send an attachment without intercepting and SAAJ in netbeans just like how we send other data (with basic datatypes ) as parameters to the web service operation ?
    TIA.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

  • How to send an  email to external user (offline form) from se38

    Hi all
    how to send an  email to external user (offline form) from se38 and upload the same from recipent.
        we have sent mail using scripts and smartforms but couldnt do here. It will be helpful if you can give us any sample code
    regards
    mohammed

    Hi,
    Have a look at this thread [Re: Sending PDF forms (created using SFP) as Email Attachment]  i explain all the solution with a sample code .
    Hope it's help you
    regards

  • How to send an email from a VI

    Hello..
         I want to know how to send an email from VI. I am using Labview 8.6 . I tried some examples also. But when I run those VIs, I getting errror. It is smtp server error. I dont have any idea about how to change smtp server settings. Can any body tell step by step procedure to accomplish this task.. 
    Further, I need send an attachment with this email... 
    Please help me
    Thanks
    Prashanth
    Solved!
    Go to Solution.

    Hello harold..
               thanks for sending VI. I tried it, but I am getting following error
    Error 1172 occurred at Error calling method System.Net.Mail.SmtpClient.Send of ObjectId handle: 0xCD21184 for obj 0x212E63[System.Net.Mail.SmtpClient] in domain [LabVIEW Domain for Run] and thread 280, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
        Inner Exception: System.Net.Mail.SmtpException: Failure sending mail.
        Inner Exception: System.Net.WebException: Unable to connect to the remote server
        Inner Exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
    ) in GmailLV86.vi
    How can I solve this problem..
    Please let me know.
    Thanks
    Prashanth

  • How to Send an Email to Outlook using process type in RSPC?

    Hi,
    How to Send an Email to Outlook using process type in RSPC?
    We created lot of process variants, actually we want to send an mail to users if the DP Background job was succesfully finished.
    Actually i tried with create message its not happening...
    Plz let me know .. its urgent ...
    Regards,
    Satish

    Hello Satish,
    If you want to send a friendly message to your users, then you can do this by building an ABAP program that calls function module SO_NEW_DOCUMENT_SEND_API1 . You can then insert this ABAP program in your process chain (using the ABAP program process type) or as a second step in your background job. With this technique, you can send an email to SAP users, or to external users (e..g Outlook email addresses)
    Here's  a sample ABAP code:
      data: ls_docdata type SODOCCHGI1,
            lt_objcont type table of solisti1,
            lt_receivers type table of somlreci1,
            ls_objcont type solisti1,
            ls_receivers type somlreci1,
            ls_user type syuname.
    * Fill these variables with subject and msg lines that you need.
    data: MAIL_SUBJECT     TYPE STRING,
    MSG_LINE1     TYPE STRING,
    MSG_LINE2     TYPE STRING,
    MSG_LINE3     TYPE STRING,
    MSG_LINE4     TYPE STRING,
    MSG_LINE5     TYPE STRING.
      ls_docdata-obj_descr = mail_subject.
      ls_objcont-line = msg_line1.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line2.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line3.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line4.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line5.
      append ls_objcont to lt_objcont.
    * t_userlist contains the list of users to whom th email will be sent.
      loop at t_userlist into ls_user.
        ls_receivers-receiver = ls_user.
    "Change the type  here if email is for outlook users, See documentation
    " of function module in SE37
        ls_receivers-rec_type = 'B'.            
        ls_receivers-express = 'X'.
        append ls_receivers to lt_receivers.
      endloop.
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
          document_data                   = ls_docdata
        tables
         OBJECT_CONTENT                   = lt_objcont
         receivers                        = lt_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
    You can test out the function module first in SE37 (just put the name of the FM and click execute). Testing it in SE37 will help you get your parameters right.
    Hope this helps.

  • How to send a mail with HTML body from Oracle

    Hi Team,
    Can somebody guide me how to send a mail with HTML body from oracle.
    Here is the piece of code i am trying to send a mail.
    procedure SEND_MAIL is
    cursor c_1 is select * from table_name;
    l_mail_id varchar2(40);
    -- ls_mailhost VARCHAR2(64) := Mailhost;
    ls_from VARCHAR2(64) := ‘[email protected]
    ls_subject VARCHAR2(200);
    ls_to VARCHAR2(64);
    l_mail_conn UTL_SMTP.connection;
    ls_left_menu_name VARCHAR2(64);
    ll_emp_num number(8);
    begin
    for i in c_1 loop
    begin
    l_mail_conn := UTL_SMTP.OPEN_CONNECTION('IP');
    UTL_SMTP.HELO(l_mail_conn, 'IP');
    UTL_SMTP.MAIL(l_mail_conn, LS_FROM);
    UTL_SMTP.RCPT(L_mail_conn, LS_TO);
    UTL_SMTP.DATA(l_mail_conn,'From: ' ||ls_from || utl_tcp.crlf ||
    'To: ' ||ls_to || utl_tcp.crlf ||
    'Subject: ' ||ls_subject|| utl_tcp.crlf);
    UTL_SMTP.QUIT(l_mail_conn);
    exception
    when no_data_found then
    null;
    when others then
    RAISE_APPLICATION_ERROR(-20000, 'Failed to send mail due to the following error: ' || sqlerrm);
    end;
    end loop;
    end;
    Thnx

    Hi Nicolas!
    Have you tried to set "Output Format" for "RAW Text" to HTM in SCOT.
    If HTM is missing in your dropdown-list, you could check out table SXCONVERT2. Copy the line with category T/format TXT, and change the format from TXT to HTM. The existing function
    SX_OBJECT_CONVERT__T.TXT does not need to be changed. Now you should be able to choose HTM in SCOT. You will probably need som HTML-tags in your text to make it look good.
    Hope this helps!
    Regards
    Geir

  • How to send a file as an attachment using mailx

    Hi
    Can any one tel me how to send a file as an attachment using mailx command in shell script.
    Thanks,
    Suman.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

Maybe you are looking for

  • Unable to create per forma invoice w.r.t to Free of charge delivery

    Hi Experts, I create a free of charge delivery order type ZFD (copy from order type FD). I create a delivery (VL01N) with reference to free of charge delivery order & done PGI. But when i want to create Per forma invoice of this delivery with referen

  • Rejected password for mail account...

    Hello. How can I remedy this ongoing issue of the Mail program asking for the password multiple times per week? (quite often, I'll have to enter it 20 times in the course of 5 minutes for it to actually get accepted). I'm amazed that this hasn't been

  • Changing data in events in Table Maintenance generator

    Hi, My requirement is to default two fields while changing a row.. I tried using event 01, 02 and 03... I used the below code.. ZYREN-userid = sy-uname. zyren-lupdate = 0. Please help me in solving this.. Thanks

  • E61i Installing Applications on Start-up

    Everytime I switch off and then switch on my Nokia E61i, it will try and install applications on start-up and then display an error message saying that it can't install applications from the memory card and that I should use the application manager i

  • Populating one Internal table from two internal tables.

    Hello Gurus, iam having 3 internal table with same structure , 1st internal table having some records 2nd internal table is also having some records what i need to do is to populate the records to the 3rd internal table which the common records in th