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

Similar Messages

  • I cannot send emails with pics using the stock email app on my new Droid Turbo, it holds them in the Outbox and won't send even if I move to Inbox and resend

    I cannot send emails with pics using the stock email app on my new Droid Turbo, it holds them in the Outbox and won't send even if I move to Inbox and resend

    First check to make sure you have data turned on and not just Wi-Fi. From reading your question you seem to be saying e mail is working just not attached photos. What size are the photos as some HD photos can't be sent. Your camera may be set at a very high picture size and you can go to settings and lower the size and that may solve your mailing problem.

  • How to send an Email with content at the end of a Quiz?

    Hello,
    i have three Questions about the navigation function "sending an Email" at the end of an Test or Quiz, and i haven´t found any answers in the forum yet.
    An Information at the beginning:
    I want to use the Test without any other System, for example Moodle. It will be directly reachable with a link on a homepage.
    1) Is it possible, to send an Email with answers of the User as the content in the email, and if it´s possible, how?
    2) If it´s not possible, could i precast a Text in the email? Until now, there is only an empty Outlook-Window with the Emailadress.
    3) Is it possible, to send an Email without Outlook, so a User can use it only web-based, for example with gmx, webmail etc...
    Thank you for helping me
    Zholmar
    (German)
    Hallo,
    ich habe drei Fragen zum Versand im Rahmen der Navigationsfunktion von "Email versenden", dies soll am Ende von Test bzw. Quizanwendungen geschehen und habe im Forum leider keine entsprechende Antwort bisher gefunden.
    Zur Information:
    Der Test soll nicht in ein anderes System (z.B. Moodle) eingebettet werden, sondern lediglich per Link auf einer Homepage erreichbar sein.
    1) Ich würde gerne am Ende meines Tests eine Email versenden lassen, welche die Antworten des vorangegangenen Tests enthält, ist das möglich und wenn ja wie?
    2) Falls das nicht möglich ist, besteht die Möglichkeit, einen vorgefertigten Text + Betreff in der Email zu generieren? Derzeit öffnet sich lediglich ein Outlook Fenster bei erreichen der Folie, in welcher lediglich die angegebene Emailadresse eingetragen ist. In dieser Email soll wenn möglichst bereits ein Text integriert sein, so dass der Teilnehmer lediglich noch Angaben ergänzen muss.
    3) Ist der Email Versand auch ohne Outlook möglich? Kann die Funktion also auch rein Webbasiert erfolgen?
    Vielen Dank für die Hilfe
    Zholmar

    Sooo, which method are you wanting to use?
    Earlier I outlined the steps for the close project at end.
    If you are wanting to use the JavaScript solution, you insert a button. Then in the action, you tell the button to execute JavaScript. Then you click the Script Window button and enter the window.close(); code.
    Cheers... Rick

  • TS3899 I cannot send email from my ipad the message keeps saying rejected by the server but there is nothing wrong with my email account with talk talk as I am able to send email from my iPhone and laptop any ideas?

    My email won't send from my iPad.  It says the server rejects it almost immediately I press the send email button, although there is nothing wrong with my email account when sending from my laptop or iphone. I have cancelled the account and re-entered it but it hasn't made a difference? Anybody help?

    Hi Allan,
    Thank you for your help . The account used to work perfectly until recently, after receiving support from the provider, I deleted the account now I am trying to set the account again. 
    After putting in the first details (name, email, description) Cannot send mail the password or username for "mail.bigpond.com" is incorrect. I would expect this because the information I put in is not for Bigpond. So I press ok & I change the outgoing server (this is the one that is incorrectly labelled bigpond) to aapt, then I press save.
    Then it says "verifying" but comes up with Cannot connect using SSL do you want to try setting up the account without SSL. I press yes.
    Then I get the message "the POP server "mail.aapt.net.au" is not responding. Check your network connection & that you entered the correct information in the incoming mail server. (I ahve already checked this with aapt & it is correct.

  • 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.

  • Trying to send email with a photo attached?

    Hi Guys thanks for all your information I have carried out your requests it is still freezing and not sending.
    I have also  followed  the instructionsin in the booklet (getting started with PE11)and it is still freezing and not sending.
    The last line is Photoshop Elements 11 say's opens the message in your default email application
    where do i find this??
    Thanks again

    Hi,
    From what I remember, Yahoo is a web based mail client. Does this mean that in Edit -> Preferences -> Sharing you have selected Adobe Email Service in the Email client box?
    When you freeze, try hovering over the organizer icon in the taskbar - are there two instances? One might be headed New Message - right click on it and select maximize. See if that then displays the message.
    Brian

  • NO LUCK sending email (with Comcast) via the EDGE Network

    Cannot Send E-Mail via EDGE Network
    My primary email account is with Comcast, and using my iPhone with any Wi-Fi network I am successfully able to send/receive email.
    However, using the EDGE network I cannot send email. I found a tip on appending a port number to the outgoing mail setting (smtp.comcast.net), but this didn't work either.
    I consistently get one of these two error messages:
    "Sender address [email protected] was rejected by the server"
    -or-
    "The connection to the server 'smtp.comcast.net' failed"
    I can receive email with either EDGE or Wi-Fi networks.
    Any suggestions? I need to be able to not only receive but also SEND email via the EDGE network.
    Any help will be appreciated!
    Tim

    Your other option is to sign up for a free GMail account, and use their outgoing server. You need to create your account on the iPhone using the "Other" shortcut, which allows you to specify your comcast address, your comcast incoming mail server, but the GMail outgoing server. This will work with both Edge and WiFi.

  • 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

  • My iPhone 5 has suddenly stopped sending emails. I get the message "Enter the password for the Account account "(null)"". This has only happened since the last update to iOS but hasn't been a problem on my iPad. What is going on?

    IiPhone 5 has stopped sending emails.

    Hello, Taffy12gwen. 
    Thank you for visiting Apple Support Communities.
    Here is an article I would recommend going through when experiencing issues with mail.
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Cheers,
    Jason H.

  • 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

  • Cannot send email with Palm Treo Pro

    Hi,
    We have a Palm Treo Pro that was previously configured to sync with exchange 2003 and at the same time also had an IMAP email account setup for another email address.  We have since removed the Exchange email account and only have the IMAP account configured.  Since removing the exchange account we can no longer send email from the phone, but can receive fine.  The error we get when trying to send is listed below.
    "The message(s) could not be sent.  Check that you have network coverage and that you account information is correct then try sending again"
    The connection is fine because we can receive email and browse fine.  The account information is also correct.  We are using the SMTP server settings for the phones provider and that requires no authentication.  I have also tried a different SMTP server with the appropriate user credentials but still get that message.
    I have contacted the phone provider (Telstra) but they were no use.
    We did have to load on a self signed certificate to get the exchange email working and I dont know whether this is causing any issues.
    If anyone has any ideas it would be greatly appreciated

    Maybe this will help. If you monitor the "More Like This" box, other threads appear. Opening them usually displays other threads.
    http://https://discussions.apple.com/message/19122030#19122030
    http://https://discussions.apple.com/message/18048618#18048618

  • Sending email with multiple attachments

    Hi forum,
    I am able to send email with a single attachment using maildemo.sql from: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    But now I am trying to send email with more than 1 attachment and it does not work. My code that calls the above mentioned package is as follows:
    <code>
    PROCEDURE send (
    psender VARCHAR2,
    precipients VARCHAR2,
    pcc VARCHAR2,
    pbcc VARCHAR2,
    psubject VARCHAR2,
    pmessage VARCHAR2,
    pnumattach NUMBER) -- The number of attachments that need to be sent
    IS
    p_blob BLOB;
    p_filename VARCHAR2(200);
    p_filetype VARCHAR2(200);
    p_currSeq NUMBER;
    conn utl_smtp.CONNECTION;
    i NUMBER;
    j NUMBER;
    len NUMBER;
    BEGIN
    IF pnumattach > 1
    THEN
    conn := SEND_EMAIL_HELPER.begin_mail(
              sender => psender,
              recipients => precipients,
              subject => psubject,
              mime_type => send_email_helper.MULTIPART_MIME_TYPE);
    j := 0;
    SELECT seq_attach_transact_id.CURRVAL INTO p_currSeq FROM dual; -- seq_attach_transact_id is a primary key that identifies every single attachment in the table
    WHILE (j < pnumattach) LOOP
    p_currSeq := p_currSeq - j;
    SELECT blob_content INTO p_blob FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SELECT name INTO p_filename FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SELECT mime_type INTO p_filetype FROM wwdoc_document WHERE transaction_id = p_currSeq;
    SEND_EMAIL_HELPER.begin_attachment(
    conn => conn,
    mime_type => p_filetype,
    inline => TRUE,
    filename => p_filename,
    transfer_enc => 'base64');
    -- split the Base64 encoded attachment into multiple lines
    i := 1;
    len := DBMS_LOB.getLength(p_blob);
    WHILE (i < len) LOOP
    IF(i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH < len)THEN
    UTL_SMTP.Write_Raw_Data (conn,
    UTL_ENCODE.Base64_Encode(
    DBMS_LOB.SUBSTR(p_blob, SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH, i)));
    ELSE
    UTL_SMTP.Write_Raw_Data (conn,
    UTL_ENCODE.Base64_Encode(
    DBMS_LOB.SUBSTR(p_blob, (len - i)+1, i)));
    END IF;
    UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
    i := i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH;
    END LOOP;
    SEND_EMAIL_HELPER.end_attachment(conn => conn);
    END LOOP;
    SEND_EMAIL_HELPER.attach_text(
    conn => conn,
    data => pmessage,
    mime_type => 'text/html');
    SEND_EMAIL_HELPER.end_mail( conn => conn );
    ELSE
    utl_mail.send(psender,precipients,pcc,pbcc,psubject,pmessage);
    END IF;
    END send;
    </code>
    Can anyone please tell me where am i going wrong.
    Message was edited by:
    Monk

    The easiest is to send an e-mail with multiple attachments to yourself and then view the message in raw to see how it is formatted - how the boundaries work. what the boundary headers are, etc.
    Then you use that as a template for your PL/SQL code to generate a MIME body for an e-mail that has multiple attachments.
    To debug.. have your PL/SQL code send sample e-mails with multiple attachment to your account, view it in raw format and compare that to the original format you've based your template on.
    And none of this is really a PL/SQL issue.. it is all about formatting a valid MIME message for an e-mail.

  • Sending email with attachment (image)

    Is there any way or workaround to send emails with attachments? The only way known to me is to use mailto but how to include attachment then? Has anyone tried to do that with native extensions on iOS?

    Maybe someone experienced in ObjectiveC could support the community and write a native extension for sending email with attachments and post it here: http://www.adobe.com/devnet/air/native-extensions-for-air.html

  • Cannot send Emails with Attachemen​ts

    Hello
    i have problems sometime i can not send Emails with Attachements.
     This Problem is still for everybody on the User the are on the Blackberry Server and the Problem is for Z10 and Q10 also Z30 with the latest Firmware also with the old Firmware
    I have tryet this
    http://supportforums.blackberry.com/t5/BlackBerry-​Z10/Cannot-send-some-attachments-or-pictures-red-c​...
    but it doesnt help.
    is there any solution for the Problem ?
    Thanks a lot

    It am trying to send email with attachments they just won't send. I can receive attachment no problem.
    I try sending pictures that were taking with the phone. I tried sending attachment that I have been sent but they won't send
    either. Any help on this would be great.
    Thanks
    Mark

  • BPEL send email with attachment

    Hi guys,,
    Now i want to send email with attachment from the bpel console. In bpel console, if i want to use, "browse" button, how can i create this button in my xsd file?

    Hello,
    Well I'm using the BPEL build in decoder. It works for txt file but how about PDF? Will it be the same?
    it give me this message in the email process.
    XML Parsing Error: reference to invalid character number
    p/s: it working to txt but not pdf.
    below is the script
    <bpelx:exec name="decoder" language="java" version="1.5">
    <![CDATA[String inputString = new String();
                inputString =(String)getVariableData("attachmentContentVar");  
        try {
                String decoded = Base64Decoder.decode(inputString);  
                setVariableData("decoded",decoded); 
    catch(Exception e)
    e.printStackTrace();
    }]]>
    </bpelx:exec>
    <copy>
    <from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
    part="WfattachmentCollection"
    query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:encoding"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType"/>
    </copy>
    <copy>
    <from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
    part="WfattachmentCollection"
    query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:name"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName"/>
    </copy>
    <copy>
    <from expression="bpws:getVariableData('decoded')"/>
    <to variable="varNotificationReq" part="EmailPayload"
    query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody"/>
    </copy>
    </assign>
    Edited by: kpchong on Oct 20, 2009 12:00 AM

Maybe you are looking for