Need to send email with content of total sales

Hi experts,
I have configure notification mailer and have received also test email. Usually I may receive oracle alerts in my email address.
I need two solutions or need to build below mention point.
1) need to send email total daily sale ?
2) need to setup oracle alerts ?
I am waiting your kind response or refer solid documents to fulfil my requirements
Thanks

You can configure an alert that fires every day at about 1:00 am.
The alert can query oe_order_lines_all table for all orders lines that were created in booked status on the prior day.
Then you can format the alert to include the total amount.
You can group by sales person or by warehouse.
If you want to group the sales by item numbers, the email may become long depending on the number of items you sell every day.
See http://docs.oracle.com/cd/A60725_05/html/comnls/us/alr/summary.htm for a great example on how to send a summary alert.
Hope this helps,
Sandeep Gandhi

Similar Messages

  • Trying to send email with contents in the body of the message

    Hi,
    Has anyone been successful in modifying the RW_EMAIL_NOTIFICATION script in such a way that allows the contents of the email "body" to be sent as a parameter from a calling script? Thanks.
    Regards,
    David Carr

    David,
    Here is the solution I use which hopefully will suit your requirements and is a little more elegant than the workarounds for using rwmail.  Oracle has the ability to send SMTP emails once you enable the UTL_SMTP package. 
    Log in to Oracle as the SYS user and run the Oracle supplied script to create the UTL_SMTP package - utlsmtp.sql in the Oracle rdbms/admin directory.
    Now create a procedure that you can call subsequently in your scripts to send emails using the UTL_SMTP package.  I created this script under the SYSJCS schema as I'm only going to call it from there, but you could create it as SYS and then create a public synonym for it.
    I called my procedure send_mail (see below).  The enabling of the UTL_SMTP and the creation of the send_mail procedures are one-offs and don't have to be repeated (unless you want to change something about send_mail).  Just change the name of the mailhost in the procedure to one appropriate for your  company.
    NB: I have had to substitute the "at symbol" with *at* otherwise the forum wouldn't accept the post.
    CREATE OR REPLACE PROCEDURE send_mail (
    pSender    VARCHAR2,
    pRecipient VARCHAR2,
    pSubject   VARCHAR2,
    pMessage   VARCHAR2) IS
    mailhost  CONSTANT VARCHAR2(30) := 'yoursmtpcapable.mailserver.corp';
    crlf      CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
    mesg      VARCHAR2(1000);
    mail_conn utl_smtp.connection;
    BEGIN
       mail_conn := utl_smtp.open_connection(mailhost, 25);
       mesg := 'Date: ' ||
            TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
               'From: <'|| pSender ||'>' || crlf ||
               'Subject: '|| pSubject || crlf ||
               'To: '||pRecipient || crlf || '' || crlf || pMessage;
       utl_smtp.helo(mail_conn, mailhost);
       utl_smtp.mail(mail_conn, pSender);
       utl_smtp.rcpt(mail_conn, pRecipient);
       utl_smtp.data(mail_conn, mesg);
       utl_smtp.quit(mail_conn);
    END send_mail;
    Now you can call the send_mail procedure with, e.g.
    send_mail(pSender=>'redwood**at**mycompany.com',pRecipient=>'basisteam**at**mycompany.com',pSubject=>'Alert: Redwood job failure',pMessage=>'There has been a job failure that should be addressed a.s.a.p.');
    Here is a practical application of this email facility.  I created a trigger for ON_JOB_STATUS_CHANGE called _ERROR and here is the code that is executed.  We store contact details for business users that need to be notified of a job failure in the Comment field of the script definition, so for a failed job we grab that info and email it to a power user dlist which includes 24/7 Ops that will call-out the contacts specified.
    Any Comment field that starts with the text CRITICAL_JOB results in an email to the Ops that will perform the call-out, otherwise the email goes to a less critical dlist.
    procedure SYSJCS.ON_JOB_STATUS_CHANGE_ERROR (
      p_job_id     in integer
    , p_old_status in varchar2
    , p_new_status in varchar2
    is   
        v_script       varchar2(30);                                   
        v_step_id      varchar2(9);
        v_description  VARCHAR2(80);
        v_comment_text VARCHAR2(4000);
    begin
        if p_new_status in ('E', 'O') -- Error or Console
        then
            select script_name, decode(step_id, null,'JOB/CHAIN','STEP')
            into v_script, v_step_id
            from jcs_jobs
            where job_id = p_job_id;                              
            select description, comment_text
            into v_description, v_comment_text     
            from jcs_scripts
            where name = v_script;                              
            if ( SUBSTR(v_comment_text,1,12) = 'CRITICAL_JOB' )
            then    
               send_mail(pSender=>'redwood**at**mycompany.com',
                         pRecipient=>'criticaljobalerts**at**mycompany.com',
                         pSubject=>'CRITICAL ALERT: Job failure in '||v_script||' ('||p_job_id||')',
                         pMessage=>'Job Description: '||v_description||chr(13)||chr(13)||'Operations Team please ensure you contact one of the following people via telephone a.s.a.p.'||chr(13)||chr(13)||'Comments: '||chr(13)||v_comment_text);
            else
               send_mail(pSender=>'redwood**at**mycompany.com',
                         pRecipient=>'basisteam**at**mycompany.com',
                         pSubject=>'Alert: Job failure in '||v_script||' ('||p_job_id||')',
                         pMessage=>'Job Description: '||v_description||chr(13)||'Comments: '||chr(13)||v_comment_text);
            end if;
        end if;
    end;
    Hope this was useful.
    Regards
    Guy

  • Send Email with Contents of List Item (not from workflow)

    End users have requested the capability to email a single list item, with all its data (by which they mean the data they see in their view), to an address to be entered on the fly. In other words, they want an option in the ECB or ribbon where
    they would fill in a box with an email address (not necessarily a SharePoint user) and the contents of the selected list item would be sent out by the portals email, which is already configured.
    My searching has found similar solutions involving workflows, but nothing in the way of an 'on-demand' type of process. If this is something that needs to be developed, I am not afraid to jump in, but am hoping there might be something I can leverage already
    in place.
    I would appreciate any ideas on this.
    Echo Train Nashville TN

    Hi Echo Train,
    I would still look at using a Workflow for this. Easiest option to setup and maintain, and
    you can still enter an email (or multiple emails) on demand.
    For the List Workflow click on Initiation Parameters and add one with
    Field name of Email for example.
    Description (something like): "Please enter the email(s) you wish to send the list item information. Separate each email with a semi colon ;"
    Information type: Single line of text
    Default value: leave it blank
    Next add a Send an Email action with the following settings:
    To: Select from existing Users and Groups > Workflow Lookup for a User...
    > Data source: Workflow Variables and Parameters
    > Field from source: Parameter: Email
    > Return field as: As String
    Then setup your Subject and Body using the Fields from the Current List Item
    Save the Workflow then go back into the Workflow settings and ensure that: Allow this workflow to be manually started is the only option selected.
    Publish the workflow and your users should now be able to click on the Workflow with the ability to enter one or more emails.
    There are other options apart from using a Workflow such as setting up an Action with some ECMA script, but much more difficult to create and maintain, which in this instance I would still opt for the Workflow solution.

  • Hi need to send email with msg pls suggest a code to do so

    hi
    i want to send email to users with a simple message like for eg shipment shipped
    please suggest some code for it how to do it
    regards
    Nishant

    Here is a simple macro to do this.  Obviously this is not generic enough, but it is very easy to tweak this to do whatever you want.
    define send_mail.
      data : header_text(40).
      object_hd_change-objla  = sy-langu.
      read textpool sy-repid into text_tab language sy-langu.
      read table text_tab with key id = 'R'.
      move text_tab-entry to object_hd_change-objnam.
      concatenate text_tab-entry ' Error ' into
      object_hd_change-objdes separated by space.
      object_hd_change-objsns = 'C'.      "SENSITIVITY
      objcont-line = 'The following messages were received:'.
      append objcont.
      clear objcont.
      objcont-line = ' '.
      append objcont.
      clear objcont.
      objcont-line = &1.
      append objcont.
      receivers-recesc = 'B'.            "SAPmail to SAP user
      receivers-recextnam = sy-uname.
      receivers-recnam = sy-uname.
      receivers-sndex  = 'X'.
      receivers-rcdat     = sy-datum.
      receivers-rctim     = sy-uzeit.
      append receivers.
      call function 'SO_OBJECT_SEND'
           exporting
                object_hd_change           = object_hd_change
                object_type                = object_type
           tables
                objcont                    = objcont
                objhead                    = objhead
                objpara                    = objpara
                objparb                    = objparb
                receivers                  = receivers
           exceptions
                active_user_not_exist      = 1
                communication_failure      = 2
                component_not_available    = 3
                folder_not_exist           = 4
                folder_no_authorization    = 5
                forwarder_not_exist        = 6
                note_not_exist             = 7
                object_not_exist           = 8
                object_not_sent            = 9
                object_no_authorization    = 10
                object_type_not_exist      = 11
                operation_no_authorization = 12
                owner_not_exist            = 13
                parameter_error            = 14
                substitute_not_active      = 15
                substitute_not_defined     = 16
                system_failure             = 17
                too_much_receivers         = 18
                user_not_exist             = 19
                x_error                    = 20
                others                     = 21.
      if sy-subrc <> 0.
        write :/ 'Error Sending the Object', sy-subrc.
      else.
        Commit work.
      endif.
    end-of-definition.

  • Need to send email with excel sheet as attachment: URGENT

    Hi all....i have a requirement where i should extract data from SAP. These datas has to be sent to a mail id entered in the selection screen in excel sheet as an attachment.Can you suggest me any function module that meets the requirement...
    For kind information...there is only one selection field for entering the mail id.
    Thanks in advance
    Nanda

    Hi all....i have a requirement where i should extract data from SAP. These datas has to be sent to a mail id entered in the selection screen in excel sheet as an attachment.Can you suggest me any function module that meets the requirement...
    For kind information...there is only one selection field for entering the mail id.
    Thanks in advance
    Nanda

  • Can I use DeliveryManager just to send email with no document?

    Can I use "oracle.apps.xdo.delivery.DeliveryManager" to just send email without any document attached? or
    Is this only used to deliver the documents by email?
    I just want to use DeliveryManager just to send email with content in the body of the email. I am using BI Publisher API.
    Can any of you provide sample input for the above?

    Hi,
    You can use iMovie to record the message and save it as an email sized item and send the file as email like before.
    For those iChat AV users without a Cam and the AIM users without a cam you can do One-Way Viedo chats.
    Once you have a recorded Video file you can also drop the file on any Buddies name in you iChat Buddy list rather than using email.
    For those using other services you can set up a Jabber account and enable the required Transport/Gateways and send the files that way.
    http://www.jabber.org.au/ichat = Australian Page
    AllForces
    These are the two main information pages on how iChat can connect to the other IM services.
    Jabber Public Server list
    That would appear to be everybody.
    Ralph

  • How to send Email with Cc and Bcc using MailPackage

    Hi ,
    we are using Mail Package to send the Email using Mail Adapter.We have a requirement where we need to send Email with Cc and Bcc using Mail Package .
    Can we send Cc and Bcc using Mail Package ?
    Thanks
    Rajesh .

    HI Rajesh,
    There is a standard structure for Receiver Mail adopter which we can get from SAP market Place but it is not provided with CC if u want to use CC then you have to go with Dynamic Configuration.
    DynamicConfiguration configuration = (DynamicConfiguration) container.getTransformationParameters().getStreamTransformationConstants.DYNAMIC_CONFIGURATION);
    /*any other required fields*/
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "THeaderCC");
    configuration.put(key, "ccemail @ test.com");
    Regards
    Praveen Reddy
    Edited by: Maareddy Praveen Reddy on Aug 10, 2011 12:17 PM

  • When send email with emoticons to a pc user, emoticons show as an empty box. Also, email content has a symbol on every line. How to stop this from happening?

    When send email with emoticons to a pc user, emoticons show as an empty box. Also, email content has a > symbol on every line. How to stop this from happening?

    Dear Mr. Toad (my all-time favorite ride at Disneyland ;-) ..
    Thanks so much for your detailed reply.. my netbook is in the bedroom, turned off.. I (so far) only use it in the evening, in the bedroom.. I've saved your response, and will try your suggestions, and let you know if they solve the problem I described. I really appreciate you taking the time to post such a detailed reply..
    I can't answer your Thunderbird "configuration" questions, because I'm in the living room, using the crap Vista laptop, on which I plan to install Thunderbird, and then take Windoze Mail out in the street and drive over it a few times.. I'll get back to you one way or the other, and let you know if your instructions solved the problem, or not..
    I don't understand why Thunderbird "out of the box", so to speak, simply doesn't forward HTML emails with embedded graphics, (like Outlook Excess, and Winblows Mail do).. without having to go through those steps. I personally HATE HTML email, but over the years, it's become more and more prevelant.. so it's a problem I must fix..
    Thanks again..
    Harv..

  • Sending emails with both body and attachment to multiple recipients

    I have a requirement to send email with body and attachment to multiple recipients.
    Body of the email is a standard text. It is a proxy-to-mail scenario.
    Here is what I've done: (I'm using PI 7.11)
    One mapping from Source to Target structure (format of the attachment text file)
    Second mapping from Target Structure to Mail Package format.
    In the second mapping I'm concatenating the output of first step into "Content" of the Mail Package.
    "XIPAYLOAD" is the message protocol used.
    The "Keep attachments" option in the Mail adapter allows only to send "Content" as attachment or as body of the email.
    How to send an email with both content and text?
    The other problem is even with using ASMA, I can't send email to multiple recipients. I can only do CC and TO for 1 person each - a total of 2. Although I can resolve this by creating mailing lists, it is better if this can be addressed in PI.
    Thanks for any input you can provide!
    Edited by: crazylad on Jan 18, 2012 3:39 PM

    Thank you for your response Mikael.
    For the first question, I was able to find the solution in the following blog:
    XI Mail Adapter : Dynamically building attachment and message body content using a simple UDF
    (I just needed to search with the right set of key words )
    The key is to set the "Content Encoding" as "None" in the mail adapter. If this is not done, the mail will be sent with an attachment - untitled.bin containing both the mail body and the attachment text. Also, don't forget to check the "Keep Attachments" checkbox in the mail adapter.
    Multiple recipients could be added by separating the email IDs with a Comma. I have used ASMA to set the recipients.

  • Sending email with 2 attachments in PDF Format

    Hi,
    I have 2 ALV Layouts, totally different in Structure.
    Now I need to convert these 2 ALV layout to 2 different PDF files and send email with thses 2 attachments.
    Can anyone provide me with sample report.
    I tried searching  for it  but there is no clue for ALV report-> PDF -> email.
    Thanks
    Mohan

    Hello,
    I doubt if you really searched before posting. You will find many posts indicating how to convert your report output be it ALV or classical into spool and then in to pdf. After you get the pdf binary format, its pretty much the same attaching those and sending E-mail
    Vikranth

  • Are socket needed to send emails?????

    hi guys,
    lets say i need to send an email notification everytime i finish doing a cetain task....do i need to create and use a socket to send these emails????
    thanks in advance for any help...
    lost and blur.
    Below are the codes to send email:
    (So are socket needed???)
    public void execute(String mailto, String mailcc, String mailsub, String mailbody){
    //session object inside the catch block also(in case of DCOException).
    DCOSession ds = null;
    try{
    ds = new DCOSession(); // Create new DCOSession object
    ds.login("erstest02"); // Log in as current Notes client user
    DCOMail dm = new DCOMail(); // Create new DCOMail object
    dm.setDcoSession(ds);// Pass DCOSession to mail
    //dm.setDebug(true);
    dm.setSendTo(mailto);
    dm.setCopyTo(mailcc);
    //dm.setBlindCopyTo();
    dm.setSubject(mailsub);
    dm.setBody(mailbody);
    //System.out.println("before mail sent");
    dm.send(); // Send the mail
    ds.logout(); // Log out of the session
    System.out.println("mail sent to "+mailto);
    }catch(DCOException e1){
    e1.printStackTrace();
    try{
    if(ds!=null){
    ds.logout(); //Log out of session even if exception is thrown
    }catch(Exception ee1){
    System.out.println("Exception thrown while trying to logout of session");
    ee1.printStackTrace();
    }catch(Exception e){
    e.printStackTrace();
    try{
    if(ds!=null){
    ds.logout(); //Log out of session even if exception is thrown
    }catch(Exception ee2){
    System.out.println("Exception thrown while trying to logout of session");
    ee2.printStackTrace();
    }

    lets say i need to send an email notification
    everytime i finish doing a cetain task....do i need
    to create and use a socket to send these emails????Yes, sockets are needed to send emails. However, you don't need to deal with them yourself. You can use the JavaMail API. It will hide those low level details from you and let you deal with concepts that are related to sending emails--addresses, contents, servers, etc.
    http://java.sun.com/developer/onlineTraining/JavaMail/

  • How to send Email with attachments

    Hi im Trying to send a file as attachment using EMail Activity operator.
    Can we do it using Email activity? If yes, then how can we do it? If no, then please tell me about any other method using which i can send a email with attachments.
    Regards
    Vibhuti

    Better late than never, a comprehensive demo on the topic:
    REM
    REM maildemo.sql - A PL/SQL package to demonstrate how to use the UTL_SMTP
    REM package to send emails in ASCII and non-ASCII character sets, emails
    REM with text or binary attachments.
    REM
    REM Note: this package relies on the UTL_ENCODE PL/SQL package in Oracle 9i.
    CREATE OR REPLACE PACKAGE demo_mail IS
      ----------------------- Customizable Section -----------------------
      -- Customize the SMTP host, port and your domain name below.
      smtp_host   VARCHAR2(256) := 'smtp-server.some-company.com';
      smtp_port   PLS_INTEGER   := 25;
      smtp_domain VARCHAR2(256) := 'some-company.com';
      -- Customize the signature that will appear in the email's MIME header.
      -- Useful for versioning.
      MAILER_ID   CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
      --------------------- End Customizable Section ---------------------
      -- A unique string that demarcates boundaries of parts in a multi-part email
      -- The string should not appear inside the body of any part of the email.
      -- Customize this if needed or generate this randomly dynamically.
      BOUNDARY        CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
      FIRST_BOUNDARY  CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
      LAST_BOUNDARY   CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
                                                  utl_tcp.CRLF;
      -- A MIME type that denotes multi-part email (MIME) messages.
      MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
                                                      BOUNDARY || '"';
      MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER   := 76 / 4 * 3;
      -- A simple email API for sending email in plain text in a single call.
      -- The format of an email address is one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      -- The recipients is a list of email addresses  separated by
      -- either a "," or a ";"
      PROCEDURE mail(sender     IN VARCHAR2,
               recipients IN VARCHAR2,
               subject    IN VARCHAR2,
               message    IN VARCHAR2);
      -- Extended email API to send email in HTML or plain text with no size limit.
      -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
      -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
      -- email in non-ASCII or multi-byte character set. End the email with
      -- end_mail().
      FUNCTION begin_mail(sender     IN VARCHAR2,
                    recipients IN VARCHAR2,
                    subject    IN VARCHAR2,
                    mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                    priority   IN PLS_INTEGER DEFAULT NULL)
                    RETURN utl_smtp.connection;
      -- Write email body in ASCII
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN VARCHAR2);
      -- Write email body in non-ASCII (including multi-byte). The email body
      -- will be sent in the database character set.
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN            VARCHAR2);
      -- Write email body in binary
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                    message IN RAW);
      -- APIs to send email with attachments. Attachments are sent by sending
      -- emails in "multipart/mixed" MIME format. Specify that MIME format when
      -- beginning an email with begin_mail().
      -- Send a single text attachment.
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                   data         IN VARCHAR2,
                   mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                   inline       IN BOOLEAN  DEFAULT TRUE,
                   filename     IN VARCHAR2 DEFAULT NULL,
                      last         IN BOOLEAN  DEFAULT FALSE);
      -- Send a binary attachment. The attachment will be encoded in Base-64
      -- encoding format.
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                     data         IN RAW,
                     mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     last         IN BOOLEAN  DEFAULT FALSE);
      -- Send an attachment with no size limit. First, begin the attachment
      -- with begin_attachment(). Then, call write_text repeatedly to send
      -- the attachment piece-by-piece. If the attachment is text-based but
      -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
      -- To send binary attachment, the binary content should first be
      -- encoded in Base-64 encoding format using the demo package for 8i,
      -- or the native one in 9i. End the attachment with end_attachment.
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL);
      -- End the attachment.
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                      last IN BOOLEAN DEFAULT FALSE);
      -- End the email.
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
      -- Extended email API to send multiple emails in a session for better
      -- performance. First, begin an email session with begin_session.
      -- Then, begin each email with a session by calling begin_mail_in_session
      -- instead of begin_mail. End the email with end_mail_in_session instead
      -- of end_mail. End the email session by end_session.
      FUNCTION begin_session RETURN utl_smtp.connection;
      -- Begin an email in a session.
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                          sender     IN VARCHAR2,
                          recipients IN VARCHAR2,
                          subject    IN VARCHAR2,
                          mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                          priority   IN PLS_INTEGER DEFAULT NULL);
      -- End an email in a session.
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
      -- End an email session.
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail IS
      -- Return the next email address in the list of email addresses, separated
      -- by either a "," or a ";".  The format of mailbox may be in one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
        addr VARCHAR2(256);
        i    pls_integer;
        FUNCTION lookup_unquoted_char(str  IN VARCHAR2,
                          chrs IN VARCHAR2) RETURN pls_integer AS
          c            VARCHAR2(5);
          i            pls_integer;
          len          pls_integer;
          inside_quote BOOLEAN;
        BEGIN
           inside_quote := false;
           i := 1;
           len := length(str);
           WHILE (i <= len) LOOP
          c := substr(str, i, 1);
          IF (inside_quote) THEN
            IF (c = '"') THEN
              inside_quote := false;
            ELSIF (c = '\') THEN
              i := i + 1; -- Skip the quote character
            END IF;
            GOTO next_char;
          END IF;
          IF (c = '"') THEN
            inside_quote := true;
            GOTO next_char;
          END IF;
          IF (instr(chrs, c) >= 1) THEN
             RETURN i;
          END IF;
          <<next_char>>
          i := i + 1;
           END LOOP;
           RETURN 0;
        END;
      BEGIN
        addr_list := ltrim(addr_list);
        i := lookup_unquoted_char(addr_list, ',;');
        IF (i >= 1) THEN
          addr      := substr(addr_list, 1, i - 1);
          addr_list := substr(addr_list, i + 1);
        ELSE
          addr := addr_list;
          addr_list := '';
        END IF;
        i := lookup_unquoted_char(addr, '<');
        IF (i >= 1) THEN
          addr := substr(addr, i + 1);
          i := instr(addr, '>');
          IF (i >= 1) THEN
         addr := substr(addr, 1, i - 1);
          END IF;
        END IF;
        RETURN addr;
      END;
      -- Write a MIME header
      PROCEDURE write_mime_header(conn  IN OUT NOCOPY utl_smtp.connection,
                         name  IN VARCHAR2,
                         value IN VARCHAR2) IS
      BEGIN
        utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
      END;
      -- Mark a message-part boundary.  Set <last> to TRUE for the last boundary.
      PROCEDURE write_boundary(conn  IN OUT NOCOPY utl_smtp.connection,
                      last  IN            BOOLEAN DEFAULT FALSE) AS
      BEGIN
        IF (last) THEN
          utl_smtp.write_data(conn, LAST_BOUNDARY);
        ELSE
          utl_smtp.write_data(conn, FIRST_BOUNDARY);
        END IF;
      END;
      PROCEDURE mail(sender     IN VARCHAR2,
               recipients IN VARCHAR2,
               subject    IN VARCHAR2,
               message    IN VARCHAR2) IS
        conn utl_smtp.connection;
      BEGIN
        conn := begin_mail(sender, recipients, subject);
        write_text(conn, message);
        end_mail(conn);
      END;
      FUNCTION begin_mail(sender     IN VARCHAR2,
                    recipients IN VARCHAR2,
                    subject    IN VARCHAR2,
                    mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                    priority   IN PLS_INTEGER DEFAULT NULL)
                    RETURN utl_smtp.connection IS
        conn utl_smtp.connection;
      BEGIN
        conn := begin_session;
        begin_mail_in_session(conn, sender, recipients, subject, mime_type,
          priority);
        RETURN conn;
      END;
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN VARCHAR2) IS
      BEGIN
        utl_smtp.write_data(conn, message);
      END;
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN            VARCHAR2) IS
      BEGIN
        utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
      END;
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                    message IN RAW) IS
      BEGIN
        utl_smtp.write_raw_data(conn, message);
      END;
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                   data         IN VARCHAR2,
                   mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                   inline       IN BOOLEAN  DEFAULT TRUE,
                   filename     IN VARCHAR2 DEFAULT NULL,
                      last         IN BOOLEAN  DEFAULT FALSE) IS
      BEGIN
        begin_attachment(conn, mime_type, inline, filename);
        write_text(conn, data);
        end_attachment(conn, last);
      END;
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                     data         IN RAW,
                     mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     last         IN BOOLEAN  DEFAULT FALSE) IS
        i   PLS_INTEGER;
        len PLS_INTEGER;
      BEGIN
        begin_attachment(conn, mime_type, inline, filename, 'base64');
        -- Split the Base64-encoded attachment into multiple lines
        i   := 1;
        len := utl_raw.length(data);
        WHILE (i < len) LOOP
           IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
          utl_smtp.write_raw_data(conn,
             utl_encode.base64_encode(utl_raw.substr(data, i,
             MAX_BASE64_LINE_WIDTH)));
           ELSE
          utl_smtp.write_raw_data(conn,
            utl_encode.base64_encode(utl_raw.substr(data, i)));
           END IF;
           utl_smtp.write_data(conn, utl_tcp.CRLF);
           i := i + MAX_BASE64_LINE_WIDTH;
        END LOOP;
        end_attachment(conn, last);
      END;
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL) IS
      BEGIN
        write_boundary(conn);
        write_mime_header(conn, 'Content-Type', mime_type);
        IF (filename IS NOT NULL) THEN
           IF (inline) THEN
           write_mime_header(conn, 'Content-Disposition',
             'inline; filename="'||filename||'"');
           ELSE
           write_mime_header(conn, 'Content-Disposition',
             'attachment; filename="'||filename||'"');
           END IF;
        END IF;
        IF (transfer_enc IS NOT NULL) THEN
          write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
        END IF;
        utl_smtp.write_data(conn, utl_tcp.CRLF);
      END;
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                      last IN BOOLEAN DEFAULT FALSE) IS
      BEGIN
        utl_smtp.write_data(conn, utl_tcp.CRLF);
        IF (last) THEN
          write_boundary(conn, last);
        END IF;
      END;
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        end_mail_in_session(conn);
        end_session(conn);
      END;
      FUNCTION begin_session RETURN utl_smtp.connection IS
        conn utl_smtp.connection;
      BEGIN
        -- open SMTP connection
        conn := utl_smtp.open_connection(smtp_host, smtp_port);
        utl_smtp.helo(conn, smtp_domain);
        RETURN conn;
      END;
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                          sender     IN VARCHAR2,
                          recipients IN VARCHAR2,
                          subject    IN VARCHAR2,
                          mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                          priority   IN PLS_INTEGER DEFAULT NULL) IS
        my_recipients VARCHAR2(32767) := recipients;
        my_sender     VARCHAR2(32767) := sender;
      BEGIN
        -- Specify sender's address (our server allows bogus address
        -- as long as it is a full email address ([email protected]).
        utl_smtp.mail(conn, get_address(my_sender));
        -- Specify recipient(s) of the email.
        WHILE (my_recipients IS NOT NULL) LOOP
          utl_smtp.rcpt(conn, get_address(my_recipients));
        END LOOP;
        -- Start body of email
        utl_smtp.open_data(conn);
        -- Set "From" MIME header
        write_mime_header(conn, 'From', sender);
        -- Set "To" MIME header
        write_mime_header(conn, 'To', recipients);
        -- Set "Subject" MIME header
        write_mime_header(conn, 'Subject', subject);
        -- Set "Content-Type" MIME header
        write_mime_header(conn, 'Content-Type', mime_type);
        -- Set "X-Mailer" MIME header
        write_mime_header(conn, 'X-Mailer', MAILER_ID);
        -- Set priority:
        --   High      Normal       Low
        --   1     2     3     4     5
        IF (priority IS NOT NULL) THEN
          write_mime_header(conn, 'X-Priority', priority);
        END IF;
        -- Send an empty line to denotes end of MIME headers and
        -- beginning of message body.
        utl_smtp.write_data(conn, utl_tcp.CRLF);
        IF (mime_type LIKE 'multipart/mixed%') THEN
          write_text(conn, 'This is a multi-part message in MIME format.' ||
         utl_tcp.crlf);
        END IF;
      END;
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        utl_smtp.close_data(conn);
      END;
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        utl_smtp.quit(conn);
      END;
    END;
    /

  • Send email with PDF attachements (Smartform/SAP script)

    Hello All,
    I have 3 existing programs A, B & C whose output is in SAP Script/Smartform. Now I need to create new program D which needs to execute program A, B & C and then convert their smartform/SAP script output into PDF format and send email with attachements (PDF files). Any pointers how I can proceed. Thanks a lot.

    hi Sarita,
      v_ctrlparams-no_dialog = 'X'.
      v_ctrlparams-getotf = 'X'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname = 'Smartform name'
        IMPORTING
          fm_name  = v_func_mod.
      CALL FUNCTION v_func_mod
        EXPORTING
          control_parameters = v_ctrlparams
        IMPORTING
          job_output_info    = v_joboutput
        TABLES
          t_nonsigner        = t_nonsigner.
    fill the document
      doc_chng-obj_name = 'Descriptoipn'.
    Fill the subject line
    doc_chng-obj_descr = 'Manpowe'.
      doc_chng-obj_descr = 'Reminder .
      doc_chng-sensitivty = 'P'.
    Fill the content of the mail
      objcont = 'Dear all,'.
      APPEND objcont.
      CLEAR objcont.
      APPEND objcont.
      CLEAR objcont.
      objcont =
    'The manpower sign-off is pending for the list of employees as per th' &
    'e attached sheet.'
      APPEND objcont.
      CLEAR objcont.
      APPEND objcont.
      CLEAR objcont.
      objcont =
      'Please click on the following link for the manpower sign-off:'.
      APPEND objcont.
      CLEAR objcont.
      APPEND objcont.
      CLEAR objcont.
      DESCRIBE TABLE objcont LINES entries.
      READ TABLE objcont INDEX entries.
      doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).
    Creating the entry for the compressed document
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = entries.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    Creating the document attachment
    (Assume the data in OBJBIN are given in BMP format)
      LOOP AT v_joboutput-otfdata INTO wa_otfdata.
        APPEND wa_otfdata TO objbin.
        CLEAR wa_otfdata.
      ENDLOOP.
      DESCRIBE TABLE objbin LINES tab_lines.
      objhead = 'NonSignerDetails.otf'. APPEND objhead.
    Creating the entry for the compressed attachment
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num   = 1.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'OTF'.
      objpack-obj_name   = 'ATTACHMENT'.
      objpack-obj_descr = 'NonSignerDetails'.
      objpack-doc_size   = tab_lines * 255.
      APPEND objpack.
    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               = objcont
          receivers                  = reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
    hope this will help u..
    regards,
    Santosh Thorat

  • Is there any problem to use multiple threads to send email with JavaMail

    Dear all,
    I am using JavaMail 1.3.2 to send emails with SMTP, it works very well for a long time.
    But one day, I found that the email service hanged and I could never send email again until I restart the tomcat. I found that the reason was a deadlock had been created, the required resource for sending email had not been released.
    I guess the error is due to multiple threads are sending email at the same time. I made a test to create seperate thread for sending each email. After few days, I found this deadlock happened again. So, my question is: Can I use JavaMail with multiple threads? If not, I may need to sychronized all the thread that using JavaMail. I would like to make sure this is the reason for causing the deadlock problem.
    Here is part of my code for using JavaMail:
    transport = session.getTransport("smtp");
    transport.connect(email_host, smtp_user, smtp_pass);
    message.saveChanges();
    transport.sendMessage(message,message.getAllRecipients());
    which is very standard call, and it worked well for a long time.
    Here is part for my thread dump on tomcat:
    (Thread-339)
    - waiting to lock <0x5447c180> (a sun.nio.cs.StandardCharsets)
    (Thread-342)
    - locked <0x5447c180> (a sun.nio.cs.StandardCharsets)
    It seems that these happened after call the method transport.sendMessage() or message.updateChanges()
    , and the underlying implementation may require the JRE StandardCharsets object. But the object had been locked and never be released. So, the sendMessage() or updateChanges() can't be completed.
    Please give me some helps if you have any idea about it.
    Thanks very much!
    Sirius

    Note that the Nightly build gets updated daily (and sometimes more than once in case of a respin) and it is always possible that something goes wrong and it doesn't work properly, so be prepared for issues if you decide to stay with the Nightly build and make sure to have the current release with its own profile installed as well in case of problems.
    See also:
    * http://kb.mozillazine.org/Testing_pre-release_versions
    *http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    *http://kb.mozillazine.org/Shortcut_to_a_specific_profile
    *http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

Maybe you are looking for