Send mail in a trigger

I want to send a mail in a After Insert Trigger to a defined user with oracle 8.1.7.
How can i do ?
PLZ HELP!!

AskTom has a number of discussions about how to use the utl_smtp package to send mail. One such discussion is
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:255615160805
In this forum or the SQL/ PLSQL forum, there was also a discussion on this exact topic in the past few weeks.
Justin

Similar Messages

  • Sending mails automatically using trigger concept-Auto Responder

    I am developing an application in which i had to develop an Auto Responder application. For this application i need to send different mails to different customers automatically on different days. Though i got the concept of using timers and the scheduling process from some of the developers, I think it is not suitable for our application because it is a standalone program and it needs to be executed seperately. I am not much sure of this mail application using timers and scheduling concept.
    So i need a different application where i can be using triggers in database so that it runs embedded in the application.. As per my idea i will be having two variables x and y in the database. X will be a fixed value which contains the no. of days after which a mail has to be sent to the customer.Y is a counter variable which is initialised to 0 and will be incremented daily(For this i wrote a trigger). Once x and y are equal mail should be sent automatically. But the problem is that i need to monitor this application continously. I don't know how to monitor this application. Therefore i request your help in this regard and tell me whether my idea is correct. If it is correct plz tell me how to do it and if possible send me an example.
    Thank you,

    Hi,
    if u dont want use a standalone application , U can integrate ur schedular class (which i mentioned earlier ) using quartz ,
    go to this URL
    http://www.opensymphony.com/quartz/
    cheers
    Rajendra Bandi

  • Trigger mail(sending mail to respective person)when budget is release in PS

    Dear Sir,
    I want to trigger mail ( sending mail to respective person ) when budget is release in PS.
    Please help for following :
    Option 1 : User exit
    Option 2: Workflow.
    Regards
    Vinu

    Hi Vinod,
    You can acheive this using a Workflow. What you need to do is set an user status as Rbud-release budget, and when ever you project is set to this status a workflow will trigger to the concerned aggest assigned to workflow task. Here you can provide a user decision as 1. Approve 2. Reject. When ever workflow triggers, approver can see in his inbox the project budget in Cj30 by clicking object link to cj30 and if he feels it is ok then he can click Approve button this will take him to CJ32 screen where he can release the budget. IF the user feels Budget need to be revised then he will click reject this will send an email to the person responsible to revise the budget and at the same time user status will be reset back to previous user status.
    The above  method we have adapted for one of our client. This is done by a workflow consultant.
    Thanks
    regards
    kishore

  • SEND Mail Step Mail body is not getting displayed in SOST Transaction

    Hi Gurus,
        I have a very strange problem. I have developed a workflow to send notifications.  My client wants to send notifications in different languages based on the user. If the users language is english, the notification mail should trigger in english. If the user's language is French, then the notification mail should trigger in French. like if the user's language is chinese, the notification should be in chinese.
         I have used the Standard text objects (SO10) and read the text based on language of the user into the workflow container element. We have passed that container element (which has the required text in users language) to text_lines in SEND MAIL step of the workflow.  I am getting the text in the correct language based on the user.
        When the mail triggers to user, the user is getting a blank email. There is no body/text in that email.  We have checked the SOST transaction and observed that the notification email doesnt have any body, even though we have the text in workflow log.   For the users who have the English language, they are getting the text in their mail, SOST and workflow log. Where as for the other languages (French, Chinese, Spanish etc...), they are getting the blank mail, (SOST doesnu2019t have body text) but in workflow log the correct text(based on user language) is getting displayed.
        I tested the same workflow in devlopment & quality, everything is working fine. All users (English & Non-English) getting mails in their respective languages. Where as in production, only for English users it is working, but for Non-English users it is not working.   I have compared all three environments workflow definitions and they are same. I do not understand why this is behaving differently in production. Could you please help me how do I resolve this issue. 
        May I know, does any one has faced similar issue. I request you to throw some light in this area.
       Thanks in advance.
    Regards,
    V.Nagaraju

    Hello,
    Interesting! That seems like a foolproof way to handle the language problem
    which can be a challenge in multi-language workflows. Please be sure to tell us
    how you solve this and what the cause was.
    You keep referring to the language of the "user". I assume you mean the
    mail recipient?
    You have to watch out with the workflow logs, they take the language settings
    of the person viewing it into account when displaying texts, unlike SOST.
    "I have used the Standard text objects (SO10) and read the text based on language of the user into the workflow container element"
    Which user actually executes the method to do this? Is it WF-BATCH?
    Are you using an actual SendMail step? And you reference the variable text_lines##
    in the task description?
    regards
    Rick Bakker
    hanabi technology

  • Sending Mails to Multiple Recipients using UTL_SMTP

    create or replace procedure send_mail(msg_text varchar2) is
    c utl_smtp.connection;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
    END;
    BEGIN
    c := utl_smtp.open_connection('outlook.abc.com');
    utl_smtp.helo(c, 'abc.com');
    utl_smtp.mail(c, '[email protected]');
    utl_smtp.rcpt(c, '[email protected]');
    utl_smtp.open_data(c);
    send_header('From', '"root" <[email protected]>');
    send_header('To', '"abc" <[email protected]>');
    send_header('Subject', 'WARNING: Salary has been changed');
    utl_smtp.write_data(c, utl_tcp.CRLF || msg_text);
    utl_smtp.close_data(c);
    utl_smtp.quit(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    BEGIN
    utl_smtp.quit(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    NULL; -- When the SMTP server is down or unavailable, we don't have
    -- a connection to the server. The quit call will raise an
    -- exception that we can ignore.
    END;
    raise_application_error(-20000,
    'Failed to send mail due to the following error: ' || sqlerrm);
    END;
    ==============
    when I execute the above using
    sql> exec send_mail('hihihih');
    I am getting the mails..no problems...
    So..I created the following trigger and used the above procedure to send the mail...
    CREATE OR REPLACE TRIGGER test_emp_table_trg
    AFTER UPDATE
    ON test_emp_table
    FOR EACH ROW
    WHEN (NEW.sal <> OLD.sal)
    DECLARE
    l_employee_name VARCHAR2 (240);
    l_old_sal VARCHAR2 (240);
    l_new_sal VARCHAR2 (240);
    l_message VARCHAR2 (240);
    BEGIN
    /* Gets the employee full name */
    BEGIN
    SELECT ename
    INTO l_employee_name
    FROM test_emp_table
    WHERE empno = :OLD.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_employee_name := NULL;
    END;
    /* Gets the old Salary */
    BEGIN
    SELECT sal
    INTO l_old_sal
    FROM test_emp_table
    WHERE empno = :OLD.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_old_sal := 0;
    END;
    /* Gets the new salary */
    BEGIN
    SELECT sal
    INTO l_new_sal
    FROM test_emp_table
    WHERE empno= :NEW.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_new_sal := 0;
    END;
    l_message:=
    'Employee Name= '
    || l_employee_name
    || 'Old Salary= '
    || l_old_sal
    || 'New Salary= '
    || l_new_sal;
    BEGIN
    send_mail (l_message);
    END;
    END;
    ===================
    I am not getting desired output..what might be problem friends...I am getting 0 values for old salary and new salary......
    One more thing..when i use 2 receipts in the send_mail procedure like this...I added the following lines in the procedure to send to multiple receipents..
    ======
    utl_smtp.rcpt(c, '[email protected]');
    utl_smtp.rcpt(c, '[email protected]');
    =============
    Pleas have a look and correct me, where i went wrong....
    Edited by: oraDBA2 on Sep 22, 2008 3:12 PM

    Hi, You can use the following routine to send mail to multiple recipients through utl_smtp.
    create or replace package mail_pkg
    as
    type array is table of varchar2(255);
    procedure send( p_sender_e_mail in varchar2,
    p_from in varchar2,
    p_to in array default array(),
    p_cc in array default array(),
    p_bcc in array default array(),
    p_subject in varchar2,
    p_body in long );
    end;
    create or replace package body mail_pkg
    begin
    g_crlf char(2) default chr(13)||chr(10);
    g_mail_conn utl_smtp.connection;
    g_mailhost varchar2(255) := 'ur mail server';
    function address_email( p_string in varchar2,
    p_recipients in array ) return varchar2
    is
    l_recipients long;
    begin
    for i in 1 .. p_recipients.count
    loop
    utl_smtp.rcpt(g_mail_conn, p_recipients(i));
    if ( l_recipients is null )
    then
    l_recipients := p_string || p_recipients(i) ;
    else
    l_recipients := l_recipients || ', ' || p_recipients(i);
    end if;
    end loop;
    return l_recipients;
    end;
    procedure send( p_sender_e_mail in varchar2,
    p_from in varchar2,
    p_to in array default array(),
    p_cc in array default array(),
    p_bcc in array default array(),
    p_subject in varchar2,
    p_body in long );
    end;
    is
    l_to_list long;
    l_cc_list long;
    l_bcc_list long;
    l_date varchar2(255) default
    to_char( SYSDATE, 'dd Mon yy hh24:mi:ss' );
    procedure writeData( p_text in varchar2 )
    as
    begin
    if ( p_text is not null )
    then
    utl_smtp.write_data( g_mail_conn, p_text || g_crlf );
    end if;
    end;
    begin
    g_mail_conn := utl_smtp.open_connection(g_mailhost, 25);
    utl_smtp.helo(g_mail_conn, g_mailhost);
    utl_smtp.mail(g_mail_conn, p_sender_e_mail);
    l_to_list := address_email( 'To: ', p_to );
    l_cc_list := address_email( 'Cc: ', p_cc );
    l_bcc_list := address_email( 'Bcc: ', p_bcc );
    utl_smtp.open_data(g_mail_conn );
    writeData( 'Date: ' || l_date );
    writeData( 'From: ' || nvl( p_from, p_sender_e_mail ) );
    writeData( 'Subject: ' || nvl( p_subject, '(no subject)' ) );
    writeData( l_to_list );
    writeData( l_cc_list );
    utl_smtp.write_data( g_mail_conn, '' || g_crlf );
    utl_smtp.write_data(g_mail_conn, p_body );
    utl_smtp.close_data(g_mail_conn );
    utl_smtp.quit(g_mail_conn);
    end;
    end;
    begin
    mail_pkg.send
    (p_sender_e_mail => 'urmail',
    p_from => 'urmail',
    p_to => mail_pkg.array( 'urmail','othersmail' ),
    p_cc => mail_pkg.array( ' othermail ' ),
    p_bcc => mail_pkg.array( '' ),
    p_subject => 'This is a subject',
    p_body => 'Hello Buddy, this is the mail you need' );
    end;
    /

  • Error While sending mail

    Working with 9.1.0.1
    I have created a task which will send Mail to user when password is changed.
    so in Notification Tab i Have clicked user check box and attached a appropiate Email Defination,
    when task is triggered password is changed in OID but while sending mail i am getting below error.
    I checked in metalink its shows when Email Server IT Res Name should be same as that configured in System property ,i checked both are same.
    1 Dec 2011 18:06:54,735,[XELLERATE.REQUESTS],Class/Method: tcEmailNotificationUtil/sendEmail encounter some problems: {1}
    lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:394)
    at com.thortech.xl.dataobj.util.tcEmailNotificationUtil.sendEmail(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.checkForEmailNotification(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.eventPostUpdate(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.updateSchItem(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.finalizeProcessAdapter(Unknown Source)
    at com.thortech.xl.adapterfactory.events.tcAdpEvent.finalizeAdapter(Unknown Source)
    at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpOIDMODIFYUSER.implementation(adpOIDMODIFYUSER.java:81)
    at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.client.events.tcTriggerUserProcesses.insertMileStones(Unknown Source)
    at com.thortech.xl.client.events.tcTriggerUserProcesses.trigger(Unknown Source)
    at com.thortech.xl.client.events.tcUSRTriggerUserProcesses.implementation(Unknown Source)
    at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.eventPostUpdate(Unknown Source)
    at com.thortech.xl.dataobj.tcUSR.eventPostUpdate(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.update(Unknown Source)
    at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
    at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
    at com.thortech.xl.ejb.beansimpl.tcUserOperationsBean.updateUserData(Unknown Source)
    at com.thortech.xl.ejb.beansimpl.tcUserOperationsBean.updateUser(Unknown Source)
    at com.thortech.xl.ejb.beans.tcUserOperationsSession.updateUser(Unknown Source)
    at com.thortech.xl.ejb.beans.tcUserOperations_voj9p2_EOImpl.updateUser(tcUserOperations_voj9p2_EOImpl.java:1763)
    at Thor.API.Operations.tcUserOperationsClient.updateUser(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor485.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

    Create a task "Send Email" which will be called on SUCCESS of Change Password Task
    Attach tcComplete in INTEGRATION tab And send Email from "Send Email" using Notification Tab
    It seems that issue is with Change Password Task
    Or Use APIs
    Re: Send Mail via java code but using Mail Definitions

  • Issue  while sending mails using classes

    Hi Experts ,
    i have one issue when i try to send mails using classes cl_document_bcs,cl_cam_address_bcs,cl_bcs etc
    ISSUE :
    i put some data in selection screen and i get some output ( say i got 5 records), i select 3 records and press some button to trigger mail and mail is send, and now again the OUTPUT screen is  shown with  sended records but we can not send these records again ............ now i selcect remaining two records  and press button to trigger mail and THIS TIME MAIL IS NOT SEND.
    amd my code is :
    CREATE OBJECT l_document.
      CREATE OBJECT l_recipient.
      TRY.
          cl_bcs_convert=>string_to_solix(
          EXPORTING
          iv_string = fp_wa_output
          iv_codepage = fp_v_code_page
          iv_add_bom = 'X'
          IMPORTING
          et_solix = l_wa_output_binary
          ev_size = l_v_size ).
          l_send_request = cl_bcs=>create_persistent( ).
    *-->Creating Document
          l_document = cl_document_bcs=>create_document(
          i_type = 'RAW'
          i_text = fp_it_content[]
          i_subject = fp_text_48 ) .
    *-->Adding Attachment*
          CALL METHOD l_document->add_attachment
            EXPORTING
              i_attachment_type    = fp_text_049
              i_attachment_size    = l_v_size
              i_attachment_subject = fp_v_file
              i_att_content_hex    = l_wa_output_binary.
    *-->Add document to send request*
          CALL METHOD l_send_request->set_document( l_document ).
    *    do send delivery info for successful mails
          CALL METHOD l_send_request->set_status_attributes
            EXPORTING
              i_requested_status = 'E'
              i_status_mail      = 'A'.
    *-->Get Sender Object
          l_uname = sy-uname.
          l_sender = cl_sapuser_bcs=>create( l_uname ).
          CALL METHOD l_send_request->set_sender
            EXPORTING
              i_sender = l_sender.
          LOOP AT fp_s_mail INTO l_wa_mail.
            l_v_objid = l_wa_mail-low.
            l_v_mail = l_v_smtpadr.
            TRANSLATE l_v_mail TO LOWER CASE.
            l_recipient = cl_cam_address_bcs=>create_internet_address( l_v_mail ).
            CALL METHOD l_send_request->add_recipient
              EXPORTING
                i_recipient  = l_recipient
                i_express    = 'X' .
    *            i_copy       = ' '
    *            i_blind_copy = ' '
    *            i_no_forward = ' '.
          ENDLOOP.
    **-->Trigger E-Mail immediately*
    *      IF fp_send_all EQ 'X'.
    *        l_send_request->set_send_immediately( 'X' ).
    *      ENDIF.
          CALL METHOD l_send_request->send(
          EXPORTING
          i_with_error_screen = 'X'
            RECEIVING result = l_v_sent_to_all ).
          BREAK TARK.
          IF l_v_sent_to_all = 'X'.
            MESSAGE i000 .
          ENDIF.
        COMMIT WORK.
        CATCH cx_document_bcs INTO l_bcs_exception.
        CATCH cx_send_req_bcs INTO l_send_exception.
        CATCH cx_address_bcs INTO l_addr_exception.
        CATCH cx_bcs INTO l_exp.
      ENDTRY.
    thanks in advance
    rahul

    Every time when i choose other network or dongle to send those mails it gets sent.
    As per the description, seems it's an issue related to this specific network. Probably, they've adjusted their security policy, like blocked some port numbers, etc.
    You might need to contact the support of your ISP to confirm what SMTP settings you need. Check port number, and security settings.
    By the way, this is the forum to discuss questions and feedback for Windows-based Microsoft Office client. Since your query is directly related to
    Office for mac, I would suggest you to post in the forum of
    Office for Mac, where you can get more experienced responses:
    http://answers.microsoft.com/en-us/mac/forum/macoffice2011?tab=Threads
    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.
    Regards,
    Ethan Hua
    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.

  • ERMS : Send mail on saving Sales Order

    HI,
    How can we send mail through ERMS on saving the Sales Order. I know about ERMS...All setting are done but i don't know on which event this will get trigger.  i have maintained the following rule :
    If
    ICWC_Order:type Equals Home 'ZXX'
    Then
    Forward eMil To ( Forward To = "abc@abclcom"; Forward From = acb@acbcom )
    I know we can call this action in IC webclient through ESCALATION button. But how we can call this action on SAVE ORDER.
    Please Help...
    Regards,
    Ankush

    Hi Ankush
    You can also achieve the same results using actions.
    Here are some details how it works:
    1. Action profile which triggers an email on Order save. Assign the action profile to Transaction
    2. Smartform to put data email
    3. Forward To address can picked up from Partners
    4. From address can be setup in SCOT
    Hope this helps
    Rupesh

  • Not able to pass a date in send mail utility.

    Hi,
    The requirement is :
    when some one is getting terminated in HR, send a mail to a fixed set of people.
    I created a trigger on Insert. Passing the person_id and calling a conc program. The IN to the conc program is person id. Now in the pkg I am using a cursor to get some details and sending as a send mail. Using FND_Message.
    But when I am trying to pass the end_date as a part of the message it's not working. I gave fnd_log to check what is getting passed in that date, but it's always null. Not sure why.
    I even tried using to_char but does not help. Any clue?

    Shankzzz wrote:
    when some one is getting terminated in HR, send a mail to a fixed set of people.Yeah.. everyone in HR should be termimated - and we, Cyberdyne Systems, have the perfect solution. It is called the Cyberdyne Systems Model 101. Easy to program. Never yet have missed a target. And as we also do not like HR, we can sell you a Model 101 at a special dis-count too.
    I created a trigger on Insert. Passing the person_id and calling a conc program. The IN to the conc program is person id. Now in the pkg I am using a cursor to get some details and sending as a send mail. Using FND_Message.
    FND_MESSAGE ?
    But when I am trying to pass the end_date as a part of the message it's not working. I gave fnd_log to check what is getting passed in that date, but it's always null. Not sure why.
    FND_LOG ?
    No idea what these are. You are perhaps talking Oracle Applications?
    In this forum we talk SQL and PL/SQL server language - the plain vanilla flavour that comes with every Oracle RDBMS database. No applications. No Forms.
    I even tried using to_char but does not help. Any clue?Why would a to_char() change a null value into a non-null value?

  • Sender Mail Adapter - CC list limitation

    Hi All,
    Is there a way to receive the CC list in the MailPackage in stead of receiving it in the message Header?
    If the above is possible, please specify the sender mail channel configurations required and the changes required to the standard SAP Mail Package XSD structure.
    Background of the issue: Mail adapter restricts the CC list in the message Header to 200 characters.
    Many thanks,
    Aldo

    Hi, Aldo:
    What I mean is that you need to created scenario:
    In my previous reply, I mean we need to use HTTP in sender side, probably we need HTTP receiver to call the serverlet to get the list of the CC.
    Then you can design a BPM scenario:
    Any Sender adapter (which can be trigger thed process) - BPM (Sync call to get response which has CC list) -> to Mail receiver which can deliver to any mail inbox.
    Just a idea since I never have done this.
    Regards
    Liang

  • Mail Adapter to trigger a process

    Hi,
    We have a scenario to do quarterly updates whenever there is an email notification from service partners. Is it possile to trigger an File>XI>r/3 scenario by using the mail adapter whenever we receive an email...I have read about the sender mail adapter configuratins. But my main question is it possible to trigger an XI process based on an incoming mail ( address and content)..
    -Teresa

    This would typically be done through a scheduled task. Write your code to query for the departure date. If someone meets your criteria for an action to occur, you can either use the addProcessTaskInstance which has an adapter attached to it to send the email, or in your code, send the email.
    The details that need to be considered though is where the departure date is stored. Is it on a process form, or is it on the user's OIM profile. Do you want to disable the user or revoke the object instance at this departure date? You could use the notification tab of these existing tasks if so.
    -Kevin

  • Sending Mail to  when MIGO,MIRO or VL09 gets triggered

    Hi,
      I have a requirement to send a mail to a designated email address when either MIGO,MIRO or VL09 gets triggered.And we were triggering the mails from the correponding user exits since  triggering mail trigger in the form of delivery output by creating an output type was not faesible for our requirement since we had to do  some more checks for company code,movement type etc before triggering output type to send mail.
    I want to know if this is is not a correct solution from technical point of view to trigger emails from any document processing user exits?
    Thanks,
      Chithra

    I have the same request, did you solve it?

  • Sending mail to email id

    dear all,
    i want to send mail..
    in that program i am using submit call one program and output of that i hv to send to email as pdf attachment.....
    in regular execution its fine working but when i m running in background it will not work properly. as well as i m  running in background then also it not create any spool of that.
    pls check my code.
    SUBMIT YPPDAILYUPDATE
    with pstngdt in temp
    with entdate eq ' '
    with posdate eq 'X'
    with rdata eq 'X'
    with logic eq ' '
    with high eq 'X'
    with trend eq ' '
    AND RETURN
    i hv taking the help for sending mail of
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    i want output of this calling program will be make spool & send as a .pdf attachment
    for that wht i hv to do.....
    pls help....!!
    its a great for me..
    regards,
    Arpit.

    Arpit,
        I am enclosing the sample code to trigger an email, The logic for this is in comments, check this I am shure yuor problem will be solved.
    *& Report  ZGBL_SLA_PER
    REPORT zgbl_sla_per NO STANDARD PAGE HEADING LINE-COUNT 26(3) MESSAGE-ID
    zmsg2.
    DECLARATION OF DB TABLES
    TABLES: zncrfid, zrule_id.
    DECLARATION OF INTERNAL TABLES
    DATA: BEGIN OF ncrf OCCURS 0,
            zncrf_id(15) TYPE c,
            zncrf_l4_name(60) TYPE c,
            z9gl_sla_flag(1) TYPE c,
            zowners(30) TYPE c,
            zowners_value(30) TYPE c,
            zdate_changed(8) TYPE n,
            ztime_changed(6) TYPE n,
          END OF ncrf.
    *DATA: NCRF LIKE ZNCRFID OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF it_ruleid OCCURS 0,
            zrule_id(10) TYPE c,
            zowners(30) TYPE c,
            zowners_value(30) TYPE c,
          END OF it_ruleid.
    *data: wa like ncrf occurs 0 with header line.
    DATA: BEGIN OF itab OCCURS 0,
                    zncrf_id(15) TYPE c,
                    zncrf_l4_name(60) TYPE c,
                    z9gl_sla_flag(1) TYPE c,
                    zowners(30) TYPE c,
                    zowners_value(30) TYPE c,
                    zdate_changed(8) TYPE n,
                    ztime_changed(6) TYPE n,
    END OF itab.
    data: file(10) type c,
             dates type date.
    EMAIL DECLARATION
    *CONSTANTS: c_subject LIKE sodocchgi1-obj_descr VALUE 'Subject',
    *c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    *DATA: g_time TYPE char8,
    *g_email(40) TYPE c,
    *g_sent_all(1) TYPE c,
    *g_doc_data LIKE sodocchgi1,
    *g_error TYPE sy-subrc.
    *DATA: i_message LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    *i_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    *DATA: BEGIN OF mailid OCCURS 0,
           zemail_id TYPE zrule_id-zemail_id,
         END OF mailid.
    *data: mailid like zrule_id occurs 0 with header line.
    UPLOADING FLAT FILE TO INTERNAL TABLE NCRF
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       filename                      = 'C:\VAMSY\file.txt'
       filetype                      = 'ASC'
       has_field_separator           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        data_tab                      = ncrf[]
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
      IF sy-subrc EQ 0.
    Checking internal table ncrf is empty then
    *delete records from TABLE ZNCRF_ID ******************************
        IF ncrf[] IS INITIAL.
          MESSAGE i003(ZMSG2).
        ELSE.
          DELETE FROM zncrfid.
        ENDIF.
    *****Values are read from rule table and checking owner and owner_value
    *from zrule_id table and inserted into ZNCRFID **************
        SELECT * FROM zrule_id INTO CORRESPONDING FIELDS OF TABLE it_ruleid
        WHERE zrule_id IN ('OWNER1', 'OWNER2').
                   append IT_RULEID.
        LOOP AT ncrf WHERE z9gl_sla_flag EQ 'Y'.
          READ TABLE it_ruleid WITH KEY zowners = ncrf-zowners
          zowners_value = ncrf-zowners_value.
          IF ncrf-zowners = it_ruleid-zowners AND ncrf-zowners_value =
          it_ruleid-zowners_value AND ncrf-z9gl_sla_flag ='Y'.
            itab-zncrf_id = ncrf-zncrf_id.
            itab-zncrf_l4_name = ncrf-zncrf_l4_name.
            itab-z9gl_sla_flag = ncrf-z9gl_sla_flag.
            itab-zdate_changed = sy-datum.
            itab-ztime_changed = sy-uzeit.
            itab-zowners = it_ruleid-zowners.
            itab-zowners_value = it_ruleid-zowners_value.
            APPEND itab.
          ENDIF.
        ENDLOOP.
    modify database table zncrfid FROM  ITAB
        LOOP AT itab.
          WRITE:/ itab-zncrf_id, itab-zncrf_l4_name, itab-z9gl_sla_flag,
          itab-zowners, itab-zowners_value, itab-zdate_changed,
          itab-ztime_changed.
          zncrfid-zncrf_id = itab-zncrf_id.
          zncrfid-zncrf_l4_name = itab-zncrf_l4_name.
          zncrfid-z9gl_sla_flag = itab-z9gl_sla_flag.
          zncrfid-zowners = itab-zowners.
          zncrfid-zowners_value = itab-zowners_value.
          zncrfid-zdate_changed = itab-zdate_changed.
          zncrfid-ztime_changed = itab-ztime_changed.
          INSERT INTO zncrfid VALUES zncrfid.
        ENDLOOP.
      ENDIF.
    ENDIF.
    *CALL FUNCTION 'DATE_TO_DAY'
            EXPORTING
                DATE = sy-datum
            IMPORTING
                WEEKDAY = file.
    **CHECKING FOR THE FIRST MONDAY OF THE MONTH.
         dates = sy-datum.
         shift dates by 6 places left.
         if file CO 'monday' and dates < 7 and dates >= 1.
         else.
             message e004(zmsg2).
         endif.
    EMAIL SEND TO OWNERS LIST
    **Fill the mail body in i_message.
    get email id's from database into internal table et_mailid
    Fill the document data.
    *g_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
    *g_doc_data-obj_langu = sy-langu.
    *g_doc_data-obj_name = 'SAPRPT'.
    *g_doc_data-obj_descr = c_subject .
    *g_doc_data-sensitivty = 'F'.
    Describe the body of the message
    Information about structure of data tables
    *CLEAR i_packing_list.
    *REFRESH i_packing_list.
    *i_packing_list-transf_bin = space.
    *i_packing_list-head_start = 1.
    *i_packing_list-head_num = 0.
    *i_packing_list-body_start = 1.
    *DESCRIBE TABLE i_message LINES i_packing_list-body_num.
    *i_packing_list-doc_type = 'RAW'.
    *APPEND i_packing_list.
    Add the recipients email address
    *LOOP AT mailid.
    *CLEAR i_receivers.
    *i_receivers-receiver = mailid-zemail_id.
    *i_receivers-rec_type = 'U'.
    *i_receivers-com_type = 'INT'.
    *i_receivers-notif_del = 'X'.
    *i_receivers-notif_ndel = 'X'.
    *APPEND i_receivers.
    *ENDLOOP.
    Call the FM to post the message to SAPMAIL
    *CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    *EXPORTING
    *document_data = g_doc_data
    *put_in_outbox = 'X'
    *commit_work = 'X'
    *IMPORTING
    *sent_to_all = g_sent_all
    *TABLES
    *packing_list = i_packing_list
    *contents_txt = i_message
    *receivers = i_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.
    Store function module return code
    *g_error = sy-subrc.
    Get i_receivers return code
    *LOOP AT i_receivers.
    *ENDLOOP.
    **Instructs mail send program for SAPCONNECT to send email(rsconn01)
    *WAIT UP TO 2 SECONDS.
    *IF g_error EQ 0.
    *SUBMIT zgbl_sla_per WITH mode = 'INT'
    *WITH output = 'X'
    *AND RETURN.
    REWARD IF FOUND USEFULL,
    Cheers,
    Ram.

  • Personal data change in PORTAL (PA30) - need to send mail notification

    Hi,
    When there is any change in personal data on PORTAL need to send a mail notification to the respective agents. I was able to design the workflow in such a way that , whenever there is any change in the personal data (Ex. Marital status) it trigger an event and workflow starts, inturn it send mail to external system and sap Userid.
    The question is ?
    1. If the personal data is changed from the portal , does it trigger the same event in the backend ? does 
        it  start my workflow?
    Thanks!
    Richard A

    Hello Richard,
    In my opinion same event is triggered. You can check it in transaction SWEL.
    Please have a look at the following threads more more detailed information,
    Workflow is not trigerred from the portal
    /thread/113450 [original link is broken]
    /people/alan.rickayzen/blog/2003/10/13/workflow-in-the-enterprise-portal
    Best regards,
    Abir.

  • Macbook Air- send mail to multiple person in contact with name of them in email

    Hi there, i use macbook air, in mail, i want to know if it is possible the if i wan to send email to multiple people in my contact and the name of the person will appear in the email message like Dear......... (follow by the name of person that i saved in the contact book)

    Hello Everyone,
    I have another issue.My workflow when directly executed sends mail to all users very quickly.All steps gets executed very quickly.This I could see through the workflow log and SOST and SCOT.But when I try to trigger the workflow through my transaction CRMD_ORDER(i have given proper BO and event) it is taking hours and still in Inprocess status.Infact its not even going to the first step(fetch email ids).
    I am totally confused on this behaviour.Kindly provide your ultimate solutions and I am very thankful for giving such good solutions to all my queries.
    Regds
    VLP

Maybe you are looking for

  • How can I get my workforce 600 printer to work wireless

    Does anyone know how to get an Epson Workforce 600 printer to work wireless with 10.8.3 MacBook Air.

  • How do I fix a page # outside printable area?

    When saving a .docx file in .pdf form, it places the page number slightly outside the printable area.  This did not happen on a previous version of Adobe (my flash drive crashed 2 weeks ago so I've had to load all new software).

  • Integration of webdynpro abap custom iview into standard ESS/MSS portal

    Hello all, Could anybody please throw light on how to integrate custom iview which is developed in Webdynpro ABAP into standard tab in MSS (Webdynpro java) For example.I want to add few custom fields(which are mapped to infotype 0041) into general in

  • Connect 9.0.3 Mac Add-in

    Is the Adobe Connect 9.0.3 Mac Add-in compatible with Retina Macbook Pro, i.e. does it enable interaction with the flash player dialog related to webcam and adio permissions?

  • Nested Repeat Regions

    I've got a page where I need nested repeat regions using the same data. Basically, list people who have donated money in groupings by level: $100-$199 Murray Nadia Thierry $200-$299 Dan Dan Patty I'm looking at Tom Muck's "Simulated Nested Region" ex