Sending email using PL/SQL based on a query result

Hello all,
I want to create a procedure using PL/SQL, based on a query result.Here is the scenario:
I have multiple tables in Target and Source databases that I want to compare(not the whole table but queries on these tables) and if they differ, I want to shoot an email. I have some ideas how to implement this but not sure whether it is the best approach.
select Acct_id, total from SourceTableA
minus
select Acct_id, total from TargetTableA
select Acct_id, sum from SourceTableB
minus
select Acct_id, sum from TargetTableB
If the result of any of above queries > 0 then I want to shoot an email and want to repeat this procedure in the morning every day.
I know how to implement send_mail procedure using UTL_SMTP package and how to schedule tha job by dbms_job package. But I am not sure how to implement the result of minus query. In case if minus > 0 then I also want to send the name of tables in the email message where source and target tables are not same. Should i use cursor, variable or insert the result in a new table? any help would be highly appreciated. Thanks in advance.
Khan

Actually these queries are the part of our daily testing that we run everyday manually(after the scheduled ETL load) to see if there are any discrepencies between our datawarehouse tables and source tables. So instead of running these queries manually everyday we want to schedula a procedure that will shoot an email in case of any discrepency and indicate which tables have problems.

Similar Messages

  • Cannot send email using PL/SQL through Enterprise Manager 10g

    Hi
    I need to schedule a job that sends email periodically. I am using the scheduler in Oracle Enterprise Manager 10g for this. For sending the email, I am creating a PL/SQL job. The code is as follows:
    PROCEDURE send_test_message
    IS
    mailhost := 'iwblrcormsg001.sci.local';
    sender := '[email protected]';
    recipient := '[email protected]';
    mail_conn utl_smtp.connection;
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    utl_smtp.rcpt(mail_conn, recipient);
    utl_smtp.open_data(mail_conn);
    utl_smtp.write_data(mail_conn, 'This is a test message.' || chr(13));
    utl_smtp.write_data(mail_conn, 'This is line 2.' || chr(13));
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    END;
    I have setup the smtp server and received a test email from the EM notifying me of successful configuration. When the above job is run, the scheduler shows status as successful. If I go to the command step, it displays the following output:
    Output Log
    SQL*Plus: Release 10.1.0.2.0 - Production on Thu Feb 19 19:04:29 2009
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    SQL> SQL> SQL> SQL> Connected.
    SQL> SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Disconnected from Personal Oracle Database 10g Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Now, the only issue is that I do not receive any email at the address specified! I would be very grateful if someone could point out the error here.

    I would use APEX4.0 for this.
    Create an interactive report based on your data. Add a chart to that report and use the NOTIFY feature to send you the email.

  • How to send email using pl/sql containing the result set as the msg body

    Hi.. im using Pl/SQL code to send emails to the users from a dataset that is obtained in a databse table. i have used utl_smtp commands to establish the connection with the smtp mail server. im stuck at the logic when i have to include the message body which is actually the result set of a table.. For instance
    IF (p_message = 0) THEN
    UTL_SMTP.write_data(l_mail_conn, 'There is no mismatch between the codes' || UTL_TCP.crlf);
    ELSE
    UTL_SMTP.write_data(l_mail_conn, 'The missing codes are ' || UTL_TCP.crlf);
    for s in (select * from temp)
    loop
    UTL_SMTP.write_data(l_mail_conn, ' ' ||s || UTL_TCP.crlf);
    end loop;
    END IF;
    UTL_SMTP.close_data(l_mail_conn);
    UTL_SMTP.quit(l_mail_conn);
    END;
    ***p_message is a prameter passed to this procedure..
    Can i obtain the result in the form i have it in my table. which has three columns. I want to display the three columns as it is with teh records. ?

    this is not related about this forum but you can use below,
    CREATE OR REPLACE PROCEDURE SEND_MAIL (subject varchar2,mail_from varchar2, mail_to varchar2,mail_msg varchar2)
    IS
    mail_host varchar2(30):='XXXXX';
    mail_conn utl_smtp.connection;
    tz_offset number:=0;
    str varchar2(32000);
    BEGIN
    begin
    select to_number(replace(dbtimezone,':00'))/24 into tz_offset from dual;
    exception
    when others then
    null;
    end;
    mail_conn:=utl_smtp.open_connection(mail_host, 25);
    utl_smtp.helo(mail_conn,mail_host);
    utl_smtp.mail(mail_conn,'[email protected]');
    utl_smtp.rcpt(mail_conn,mail_to);
    utl_smtp.open_data(mail_conn);
    utl_smtp.write_data(mail_conn,'Date: '||to_char(sysdate-tz_offset,'dd mon yy hh24:mi:ss')||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'From: '|| mail_from ||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'To: "'|| mail_to ||'" <'||mail_to||'>'||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'Subject: '||subject||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,replace_turkish_chars(mail_msg)||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    END;
    Edited by: odilibrary.com on Jun 12, 2012 5:26 PM

  • Send Email using Execute SQL Task??????

    I need to send the bad records in the data flow.  I am attempting to do this using Execute SQL Tasks.  Please give me steps I need to accomplish this.  I have not set any variables up yet, assuming I need too.

    Just add a Send mail Task (or Script Task if using gmail etc which requires authentication) and pass the file as an attachment. Make sure you've a step (Script Task) to check if file length > 0 (ie file has records) before you link it to Send mail Task
    ie use a conditional precedence constraint (Expression And Constraint option)
    See these links for more details
    http://dwteam.in/send-mail-in-ssis-using-gmail/
    http://www.mssqltips.com/sqlservertip/1753/sending-html-formatted-email-in-sql-server-using-the-ssis-script-task/
    https://www.simple-talk.com/sql/ssis/working-with-precedence-constraints-in-sql-server-integration-services/
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Loss of sending email using WIFI

    As of this morning 8-20-08, after updating to 2.02, I no longer am able to send emails using my own wireless network. Previously this was no problem. Neither Fido or Apple have any idea of what I am talking about. Fido washed their hands as they do not support WIFI. How convenient, they sell the phone and charge for the service but do not support it. Videotron, my ISP, thinks the issue is my wireless router but I can send via gmail so that's out. I resovled the problem by configuring my accounts to use my gmail smtp server as a second option and now the spinning wheel is short lived and messages are sent.
    I'm sorry to say that I had fallen for all the hype about Apple but truth is they are but a Microsoft wannabe.
    Disinchanted

    So here's the wierd thing.
    I was having the same problems. Set up SMTP for Videotron when at home using relais.videotron.ca SMTP with no authenticationon port 25 & all was good in the world. However when I went out, bang. Nothing. Couldn't send a mail for love nor money.
    Thought aboutit & changed settings to use relais.videotron.ca SMTP, but this time using authentication of vltl** / password credentials with no SSL (Videotron doesn't use SSL) and again everything was fine. Of course, when I got home again, bang. Everything fell over & no more mail sending foe me!
    So I figure, when I'm at home I'm on my trusted network at port 25, I don't need authentication and all is good, but when I'm out i'm seen as potential SPAM by port 25 on videotron & get blocked.
    Tried using port 587 instead when for both home & mobile but had no luck either.
    Then a strange thing happened. I'd resolved to having to set up 2 SMTP servers on my iPhone & switching between the two based on where I was. Pain in the a**, but there's always a trade off for early adopter technology So I set up my primary SMTP to use port 25 with no authentication, and a secondary server to use the same relais.videotron.ca outgoing server, but this time WITH authentication using vltl** \ password credentials.
    After a walk to the shop when I'd been on my secondary SMTP server (successfully sending & recieving) I came home & inadvertantly forgot to swith back to my primary SMTP. Recieved a mail & then responded with no problem!
    Net result, I now have a permanently switced off primary server & a permanently switched on secondary server which uses relais.videotron.ca details with vltl** \ password authentication credentials active (like I did on my old silver iPhone) & all is good in the world, both at home & out mobile, both for sending & recieving!
    Will field test some more tomorrow but it may be a 2.0.2 bug where ther primary server details fcuk up whereas the secondary server details are stable.
    So long as it works, who cares!
    Jof

  • Cannot send emails using 5800 xpressmusic s/w vers...

    Not able to send emails using 5800 xpressmusic
    S/W Version: 11.0.008
    Custom S/w Version: 11.0.008.red.01
    Version Date: 09-12-2008
    I configured two email accounts but not able to send emails.
    I also cannot see the missed call list. If i recieve a mssed call, it shows 1 missed call. When i click on Open it says no missed calls....
    Please please help me............

    You must use mail.btinternet.com for outgoing server.  You can retain your old incoming server for your own domain, but must use the BT one for any @btinternet accounts.
    The following is my understanding based on use of the BT Yahoo mail service since September 2013.  New users may be using the new BT mail portal - I don't know how this differs.
    The BT outgoing server will block any outgoing mail sent from unauthorised accounts.  This includes those in your own domain.  The fix for this (as I understood it) is to add these accounts as sub-accounts to a primary BT mail account.  The server will then relay them.  The mail portal has an Options dialogue that lets the user manage mail accounts.  Set up another account for each [email protected]
    In Outlook, your domain accounts will need to set outgoing server to mail.btinternet.com and to authenticate using your @btinternet.com credentials.

  • How to send email via PL/SQL

    Hi guys,
    I have already read several topics about that subject. However, I haven't understood well. It is very complicated. Could somebody explain step by step or show a detail source about sending email through pl/sql?
    Thanks alot.

    876928 wrote:
    I have tried it, but I get this error.
    ora-29278 smtp transient error 421 service not available
    By the way I use gmail, I don't know how I change my settings? I mean Ain't I suppose to type my mails pass and username ?
    gmail won't forward your SPAM.
    you need to utilize local Mail Transport Agent that is explicitly configured to relay messages from DB Server

  • Sending SMS using PL/SQL

    hello friends..
    i want to send sms using pl/sql.. so i tried send_email procedure..
    but how to find Mobile Address:- to send email(sms) ?
    [email protected] - how to find domain name
    can any one help me..
    Thanks
    PROCEDURE SEND_EMAIL(pFmUser IN VARCHAR2,
    pToUser IN VARCHAR2,
    pSubject IN VARCHAR2 DEFAULT NULL,
    pBody IN VARCHAR2 DEFAULT NULL) IS
    SenderName VARCHAR2(50);
    SenderAddress Varchar2(200); -- := '<[email protected]>';
    vToReceivers varchar2(200);
    EmailServer varchar2(200); --:= 'smtp_server';
    ServerPort NUMBER:=25;
    UserName VARCHAR2(200);
    UserPass VARCHAR2(200);
    conn UTL_SMTP.CONNECTION;
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    mesg VARCHAR2( 4000 );
    mesg_body varchar2(4000);
    vCount NUMBER:=0;
    vNextPos NUMBER:=0;
    vStr NUMBER:=0;
    vPos NUMBER;
    vChk NUMBER;
    pToList VARCHAR2(4000);
    BEGIN
    conn:= utl_smtp.open_connection( EmailServer, ServerPort);
    utl_smtp.ehlo(conn,EmailServer);
    --utl_smtp.helo( conn, EmailServer );
    utl_smtp.command( conn, 'AUTH LOGIN');
    utl_smtp.command( conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( UserName ))) );
    utl_smtp.command( conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( UserPass ))) );
    utl_smtp.mail( conn, SenderAddress);
    utl_smtp.rcpt( conn, pToList);
    mesg:=
    'Date: '||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' )|| crlf ||
    'From: "'||SenderName||'" '||SenderAddress|| crlf ||
    'Subject: '||pSubject|| crlf ||
    'To: '||pToList|| crlf||
    pBody||crlf||crlf;
    utl_smtp.data( conn, mesg );
    utl_smtp.quit( conn );
    EXCEPTION
    WHEN OTHERS THEN RAISE_APPLICATION_ERROR(-20001,SQLERRM);
    END;

    user10502250 wrote:
    i want to send sms using pl/sql.. so i tried send_email procedure..
    but how to find Mobile Address:- to send email(sms) ?
    [email protected] - how to find domain name
    Exactly. You cannot simply send a SMS as an e-mail. The mail (SMTP) server needs to have a plug-in of sorts that enables it to forward a specially formatted e-mail it receives as an SMS.
    More then a decade ago, some cellular providers provided such mail servers - allowing you to specify the cellular number as either the recipient address or as the e-mail subject, with the body containing the actual SMS message.
    Due to this feature being abused and the cost of SMS transport being unrecoverable, this (as a public feature) has long since been discontinued by most, if not all, cellular network providers.
    So no, there is no magic domain(s) you can use to (spam) mobile numbers with SMS.
    If you want a SMS solution, you need to talk to a cellular provider about the products they have for 3rd party SMS integration.
    Alternatively, you need to use a dedicated cellphone, hooked up via USB/Bluetooth to a server, and use that as your SMS transport mechanism.

  • Sending Email from PL/SQL on Oracle 8.05...

    Hi,
    I need to send an email from PL/SQL, my database is on Windows
    server and it's 8.05 (sorry we're late on upgrading:(...)
    Thanks in advance
    Cecmlia

    Hello,
    Here is sample code for sending mail using PL/SQL.
    This PL/sql Procedure sends mails using SMTP server.
    Author - Mr. Adinath R. Kamode
    Date - 08/05/2001
    procedure sendmail is
    c utl_smtp.connection; -- Connectio type variable
    v_from varchar2(200);
    v_from1 varchar2(200);
    v_to varchar2(200);
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2)
    AS
    BEGIN
    -- Generates header data required from mail
    utl_smtp.write_data(c, name || ': ' || header ||
    utl_tcp.CRLF);
    END;
    begin
    c := utl_smtp.open_connection('smtp_server.pc150'); --
    Specify your SMTP -- server
    address here
    utl_smtp.helo(c, 'pc150');
    -- Define sender and receiver
    utl_smtp.mail(c, '[email protected]');
    utl_smtp.rcpt(c, '[email protected]');
    utl_smtp.open_data(c);
    send_header
    ('From','Sender<[email protected]>');
    send_header
    ('To', 'Recipient<[email protected]>');
    send_header('Subject', 'Hello');
    utl_smtp.write_data(c, utl_tcp.CRLF || 'Hello, world!');
    utl_smtp.close_data(c);
    utl_smtp.quit(c);
    end;
    Adi

  • How can I send email using two different email address that both link back to my one exchange account on my Ipad mini

    How can I send email using two different email address that both link back to my one exchange account on my Ipad mini? 
    On my PC I simply have a master return email address and use a POP for the secondary address.  Both are through the one exchange account without a problem.  I need to be able to do the same on my Ipad.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • IPhone cannot send email using Yahoo account. iPhone no envia correo Yahoo.

    Hi Everyone,
    I just got my iPhone from Movistar Venezuela and I've found I'm unable to send email using my Yahoo account. However, I can receive Yahoo email just fine (paid $20 for Mail Plus subscription), my GMail account can send and receive perfectly, and I can go surfin' Safari with no problems too.
    The error message I get is "Cannot send mail: an error occurred while delivering this message". I called Movistar Customer Support and they said everything was fine on their end...
    In typical Apple fashion, the error message is so simple I have no idea where the problem is. Does anyone know how can I get more information and how to solve this annoying problem? My Yahoo account is actually my primary account...
    Thanks in advance!
    Saludos a todos,
    Acabo de comprarme un iPhone de Movistar en Venezuela y me encuentro sin poder enviar emails con mi cuenta Yahoo. Sin embargo, si puedo recibir correo Yahoo bien (pague $20 por mi suscripcion a Mail Plus), mi cuenta de GMail si puede enviar y recibir email sin problema y puedo navergar con Safari sin ningun problema.
    El mensaje de error que recibo es el siguiente": "No se puede enviar correo: se ha producido un error al enviar el mensaje". Llame a Atencion al Cliente de Movistar y me dijeron que no habia ningun problema con mi linea o con su servicio de datos...
    Como tipica cosa Apple, el mensaje de error es tan simple que no tengo NI IDEA de cual es el problema. Alguien mas ha sufrido este problema? Sabe alguien como puedo obtener mas informacion de este error y como solucionarlo? Lamentablemente, mi cuenta Yahoo es mi correo principal...
    Gracias de antemano!

    Creo que resolvi el problema, temporalmente.
    1) Borra tu cuenta
    2) Vuelvela a crear
    3) Ve a Ajustes
    4) Ve a Mail Contactos Calendarios
    5) Ve a la cuenta problematica
    6) Ve a SMTP
    7) Anadir nuevo
    8)
    Nombre servidor: smtp.mail.yahoo.com
    Nombre de usuario: no dejar vacio
    Contrasena: no dejar vacio
    Usar SSL: si
    Autenticacion: Contrasena
    Puerto del Servidor: 25
    Lo consegui de aqui: http://www.emailaddressmanager.com/tips/mail-settings.html
    Dime que tal te funciona.
    I think I solved the issue, temporarily at least
    1) Delete account
    2) Create again
    3) Go to settings
    4) Go to Mail, Contacts, Calendars
    5) Open problematic account
    6) Go to SMTP
    7) Add a new server
    8)
    Name: smtp.mail.yahoo.com
    User name: do not leave blank
    Password: do not leave blank
    SSL: Yes
    Autentication: Password
    Port: 25
    I got this info from: http://www.emailaddressmanager.com/tips/mail-settings.html
    Let me know how this works

  • TS3899 issues sending email using my gmail account on my new iphone4s.

    so i was having issues sending email using my gmail account on my new iphone4s.  i called my provider, att - to fix the issue, mine anyway, under settings - general - reset - reset network connections.  fixes the send issue.  releases all of the other junk that was left on your old phone. 

    Hi Jari,
    Thanks to reply me.
    There is an workspace details where user solve that problem but now i have troed to access that workspace but its not working .i have cofusion how can i do this where i put
    apex_mail.send(
    p_to => v_recipient_list
    , p_from => v_from_list
    , p_subj => 'Hello world'
    , p_body => v_body
    , p_replyto => null);
    this package
    and how to and where set SMTP of Gmail and i don't know about gmail SMTP Server Specification
    i ahve jus create a form with
    P1_TO Text Field
    P1_SUBJECT Text Field
    P1_FILE_BRE File Browse...
    P1_COMMENT Textarea
    Please guid me...how can i do that step by step
    Thanks

  • Sending email using IMAP through SMTP Port 587

    Hi,
    I have been sending Mail Merged email to people in organizations that I am active in, using IMAP embedded in StarOffice 5.2 (on Windows 98 Second Edition). This worked fine until a few weeks ago when I received an error message stating that AOL, as part of their anti-spam efforts, was no longer accepting third-party emails on default port 25. All third-party email must now use port 587. I looked in the IMAP dialog and in the Tools -> Options dialog, but did not see any place to change the SMTP port. The AOL error message information page had instructions for changing the port in other applications (Outlook, Eudora, etc.), but not for StarOffice. So, I have some questions:
    1.Is it possible to change the port in StarOffice 5.2?
    2.If not, how does StarOffice 8 send Mail Merged email? Does it use IMAP, and if so, can the port be changed?
    3.Also, I like the integrated configuration in StarOffice 5.2, where database fields can be directly accessed in the Insert -> Fields -> Other dialog. In looking at the Mail Merge section in "SO8_What's New.pdf", it appears that Mail Merge in StarOffice 8 is restricted to predefined fields. Could I still access fields from my existing databases?
    These is a lot of questions, but right now I am blocked from sending Mail Merged emails which is imparing communications with volunteers who are running educational programs. I appreciate any and all help that anyone can provide.

    Please try this out!!!!!!!!!
    You can send emails using Outlook also. You can send email over Microsoft Exchange with this object (or another email server, using IMAP/POP).
    Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
    'Create an Outlook object
    Dim Outlook 'As New Outlook.Application
    Set Outlook = CreateObject("Outlook.Application")
    'Create e new message
    Dim Message 'As Outlook.MailItem
    Set Message = Outlook.CreateItem(olMailItem)
    With Message
    'You can display the message To debug And see state
    '.Display
    .Subject = Subject
    .Body = TextBody
    'Set destination email address
    .Recipients.Add (aTo)
    'Set sender address If specified.
    Const olOriginator = 0
    If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
    'Send the message
    .Send
    End With
    End Sub

  • Does any one have a sample code for sending email using IMAP ?

    Hi
    thank you for reading my post
    I have tried to use SMTP and because of some problems i could not use it and i must use Imap (authentication required)
    here is my SMTP code , does any one know how i can tune it to use Imap , or has a code snippet to send email using Imap ?
    thanks
    private static void postMail(String[] recipients, String subject, String message,
                             String from) throws MessagingException {
            boolean debug = false;
            class SMTPAuthenticator extends javax.mail.Authenticator
                    public PasswordAuthentication getPasswordAuthentication()
                        return new PasswordAuthentication(mail_usrname,mail_password);
            //Set the host smtp address
            Properties props = new Properties();
            FileInputStream fis;
            try {
                System.out.println("Loading property file");
                fis = new FileInputStream(new File("c:/email.properties"));
                props.load(fis);
                System.out.println("property file done");
            } catch (FileNotFoundException e) {
                System.out.println("file not found");
                e.printStackTrace();
            } catch (IOException e) {
                System.out.println("can not read properties file");
                e.printStackTrace();
            /*props.put("mail.smtp.user", mail_usrname);
    props.put("mail.smtp.host", smtpHost);
    props.put("mail.smtp.port", smtpPort);
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.socketFactory.port", smtpPort);
            // create some properties and get the default Session
            Authenticator auth = new SMTPAuthenticator();
            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(debug);
            // create a message
            Message msg = new MimeMessage(session);
            // set the from and to address
            InternetAddress addressFrom = new InternetAddress(from);
            msg.setFrom(addressFrom);
            InternetAddress[] addressTo = new InternetAddress[recipients.length];
            for (int i = 0; i < recipients.length; i++) {
                addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/HTML");
    System.out.println(msg.toString());
    Transport.send(msg);

    Please try this out!!!!!!!!!
    You can send emails using Outlook also. You can send email over Microsoft Exchange with this object (or another email server, using IMAP/POP).
    Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
    'Create an Outlook object
    Dim Outlook 'As New Outlook.Application
    Set Outlook = CreateObject("Outlook.Application")
    'Create e new message
    Dim Message 'As Outlook.MailItem
    Set Message = Outlook.CreateItem(olMailItem)
    With Message
    'You can display the message To debug And see state
    '.Display
    .Subject = Subject
    .Body = TextBody
    'Set destination email address
    .Recipients.Add (aTo)
    'Set sender address If specified.
    Const olOriginator = 0
    If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
    'Send the message
    .Send
    End With
    End Sub

  • Error while sending email using TemplateEmailSender in CSC server

    Hi,
    We are trying to send email using TemplateEmailSender from CSC server. But it is giving Null Pointer Exception in ProfiledMessageSource like below. The same code is working fine in commerce instance but it is failing in CSC instance. We are using ATG2007.1p3
    Any pointers would be helpful.
    Below is the error.
    Error while sending email
    java.lang.NullPointerException
            at atg.userprofiling.dms.ProfiledMessageSource.isConfiguredForProfileSubject(ProfiledMessageSource.java:196)
            at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:864)
            at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:848)
            at atg.userprofiling.SessionEventTrigger.nameContextElementPreUnbound(SessionEventTrigger.java:553)
            at atg.nucleus.GenericContext.sendPreUnboundEvent(GenericContext.java:200)
            at atg.nucleus.GenericContext.preNotifyRemovedObject(GenericContext.java:528)
            at atg.nucleus.GenericContext.removeElement(GenericContext.java:566)
            at atg.servlet.SessionNameContext.unbindFromNameContext(SessionNameContext.java:557)
            at atg.servlet.SessionNameContext.stopSession(SessionNameContext.java:534)
            at atg.servlet.SessionNameContext.decrementWrapperCount(SessionNameContext.java:242)
            at atg.servlet.SessionBindingReporter.valueUnbound(SessionBindingReporter.java:206)
            at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1625)
            at org.apache.catalina.session.StandardSession.expire(StandardSession.java:749)
            at org.apache.catalina.session.StandardSession.expire(StandardSession.java:655)
            at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1100)
            at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
            at atg.userprofiling.email.TemplateInvoker$TemplateSession.endSession(TemplateInvoker.java:935)
            at atg.userprofiling.email.TemplateEmailSender.createMessage(TemplateEmailSender.java:2387)

    Thanks for the reply.
    My issue is fixed now. It is JBOSS configuration issue. Sessions are not maintained properly that's why we are getting NULL profile in the session. Our application has multiple WARs so we fixed it by setting emptySessionPath to TRUE. If emptySessionPath attribute in server.xml is false, then each WAR will have its own jsessionid cookie.
    I did not touch ProfiledMessageSource as its required for session triggering.

Maybe you are looking for

  • IPhone 5 cellular data services failing

    ISSUE/SYMPTOMS:  iPhone 5 ONLY: Cellular Data stops intermittingly, cellular data locks up without warning, Wi-Fi data connection not working on occasion, iCloud contacts, calendar and reminders not updating, Find My Phone not working, mail or Intern

  • Image Inconsistency between LR2.2 and other apps - even on Desktop

    I've calibrated my monitor, and the images look perfect in LR. I export as jpg (sRBG), and when viewed in ACDSee, or even set as Background on the desktop (OS is Vista) the images turn up very saturated. I have to turn down the saturation in LR to ge

  • Paragraph in one block

    Hi everyone, I've a loop of a variable that will be replaced with 4-5 lines of text. I dont want to have those 4-5 lines separated on 2 pages. I want a page break at the beginning of a group if the group doesn't fit the remaining space in the page. I

  • Class exception

    some know why my class failure? :( Usage: java [-options] class [args...]            (to execute a class)    or  java [-options] -jar jarfile [args...]            (to execute a jar file) where options include:     -client       to select the "client"

  • Maybe a silly question...are unoffical OS (leaks) safe/secure to use?

    So maybe this is a silly question....I have been trying to downgrade my OS after my TMobile phone somehow downloaded an ATT update (10.2.1.3014) that wasn't supported by the Tmobile network and caused all sorts of problems with the device. After exte