Send Email Procedure

Hello,
I've tried to run the code below (to send an email), but I keep getting an error msg. (ORA-03113:end of file on communication channel).
Any thoughts on how to overcome this error?
========CODE==================
CREATE OR REPLACE PROCEDURE HSS_KOL.SP_MSViolation_Email AS
--Decalaration Area
sender VARCHAR2(300);
cc_to VARCHAR2(2000);
subject VARCHAR2(300);
mailhost VARCHAR2(200);
mail_conn utl_smtp.connection;
msg VARCHAR2(2000);
crlf VARCHAR2(2) := chr(13)||chr(10);
v_seID NUMBER;
v_msID NUMBER;
v_mgrID NUMBER;
v_msEmail VARCHAR2(150);
v_mgrEmail VARCHAR2(150);
v_location VARCHAR2(150);
v_CntDate DATE;
v_mgrRec CLOB;
v_mgrCmt CLOB;
v_cntSpend NUMBER;
--Cursor Declaration Area
CURSOR cur_ViolationInfo IS
SELECT SE_INFO.SE_ID, SE_INFO.KOL_ID, SE_INFO.Med_SCIENTIST_ID MS_ID, SE_INFO.EXCHANGE_DATE, KOL.FIRST_NAME || ' ' || KOL.LAST_NAME OL,
SE.MANAGER_COMMENT, SE.MANAGER_RECOMMENDATION, MS.EMAIL email
FROM SE_INFO, SE, KOL, MED_SCIENTIST MS
WHERE SE_INFO.SE_ID = SE.SE_ID
AND SE_INFO.KOL_ID = KOL.KOL_ID
AND SE_INFO.MED_SCIENTIST_ID = MS.MED_SCIENTIST_ID
AND (UPPER(SE.OFFLABEL_VIOLATION) = 'YES' OR UPPER(SE.AE_VIOLATION) = 'YES');
i_ViolationInfo cur_ViolationInfo%rowtype;
BEGIN
--Loop thru Violations
FOR i_ViolationInfo in cur_ViolationInfo LOOP
v_msEmail := i_ViolationInfo.email;
v_msID := i_ViolationInfo.MS_ID;
mailhost := 'localhost';
sender := '[email protected]';
v_CntDate := i_ViolationInfo.Exchange_Date;
v_seID := i_ViolationInfo.SE_ID;
--Get the Mgr. Email so we can cc him
SELECT DISTINCT email
INTO v_mgrEmail
FROM SE_INFO, REPORT_STRUCTURE RS, MED_SCIENTIST MS
WHERE MS.MED_SCIENTIST_ID IN (SELECT REPORT_TO FROM REPORT_STRUCTURE)
AND SE_INFO.SE_ID = v_seID;
--Find out if there's a spend location
SELECT COUNT(EXP_CITY)
INTO v_cntSpend
FROM SPENDING
WHERE SPENDING.SE_ID = v_SEID;
--if not, leave location null
IF v_cntSpend <1
THEN v_Location := ' ';
ELSE --get the spending location into the variable
SELECT SPENDING.EXP_CITY || ', ' || SPENDING.EXP_STATE
INTO v_Location
FROM SPENDING
WHERE SPENDING.SE_ID = v_SEID;
END IF;
subject := 'Your manager has found a violation in your SE(s)';
cc_to := v_mgrEmail; -- Managers email;
msg := 'From: ' || sender || crlf ||
'Subject: ' || subject || crlf ||
'To:' || v_msEmail || crlf ||
'CC:' || cc_to || crlf || '' ||crlf
|| 'Dear ' ||crlf || crlf
|| 'Here are the details of the violation: ' || crlf
|| 'Contact Date' || ' ' || v_CntDate || crlf
|| 'Location' || ' ' || v_Location|| crlf
|| 'Please take corrective action soon';
mail_conn :=utl_smtp.open_connection(mailhost);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, v_msEmail);
utl_smtp.rcpt(mail_conn, cc_to);
utl_smtp.data(mail_conn, msg);
utl_smtp.quit(mail_conn);
v_msID := 0;
v_CntDate := null;
v_msEmail := null;
v_seID := 0;
cc_to :='';
END LOOP;
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
utl_smtp.quit(mail_conn);
raise_application_error(-20001, 'Failed to send mail due to the following error:' || sqlerrm);
WHEN OTHERS THEN
utl_smtp.quit(mail_conn);
raise_application_error(-20002, 'The following error has occured:' ||TO_CHAR(sqlerrm));
END;
/

An ORA-03113 is symptom of an error and is in itself a totally meaningless message for determining the error.
An ORA-03113 is created by the client driver - it's not an error returned to the client by the server. This client error message simply says that the client has discovered that the Oracle Server Process that was servicing it, can no longer be communicated with.
Why?
The usual reason is that the Oracle Server Process that was servicing that client session crashed. When it did so, it took the "communication channel" down with it. This now results in an ORA-03113 on the client when the client attempts to "talk" to its server.
When an Oracle Server Process crashes, there should be traces of that - a message in the instance's alert log file recording the crash and specifying what the trace/dump file name is that was created for this crashed process.
Find that message and post your problem, with that message (full error details) in the [url http://forums.oracle.com/forums/forum.jspa?forumID=61]Database - General forum.

Similar Messages

  • ODI send Email procedure Problem

    Hi ,
    I am trying to send email using ODI
    I have found in oracle support that if we configure TRT_Send_Jython_HTML_Email.xml procedure we can send an email
    I tried doing so, but even though I select the LoadFromFile as no , I am getting the following error
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 1, in ?
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 483, in sendmail
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 352, in rset
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 294, in docmd
    File "C:\Oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\smtplib.py", line 271, in getreply
    SMTPServerDisconnected: Connection unexpectedly closed
    at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
    at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:345)
    at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:169)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2374)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1615)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1580)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2755)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:619
    Can anyone pls tell me how to resolve this problem.
    Thanks
    Ashvini

    Are you sure that you can reach the smtp server from within your network ? You would want to verify that first following this -http://support.microsoft.com/kb/153119

  • Cannot Send Email Notification Using Stored Procedure.

    Hi Friends,
    I tried to execute this job scheduler...
    begin
    dbms_scheduler.create_job(
    job_name => 'ILMS_JOB_SCHEDULE'
    ,job_type => 'PLSQL_BLOCK'
    ,job_action => 'begin ilms.check_reminder(); end; '
    ,start_date => SYSTIMESTAMP
    ,repeat_interval => 'FREQ=DAILY'
    ,enabled => TRUE
         ,end_date => NULL
    ,comments => 'Ilms job schedule for notification.');
    end;
    However, since the effect is too long I rescheduled the frequency to be every one minute in this set attribute...
    BEGIN
    DBMS_SCHEDULER.SET_ATTRIBUTE(
              name => 'ILMS_JOB_SCHEDULE'
              ,attribute => 'repeat_interval'
              ,value => 'FREQ=MINUTELY;INTERVAL=1'
    DBMS_SCHEDULER.DISABLE('ILMS_JOB_SCHEDULE');
    DBMS_SCHEDULER.ENABLE('ILMS_JOB_SCHEDULE');
    END;
    Check Reminder is the stored procedure invoked by job scheduler to check values in database columns before sending email notification to the respective recipients' email address and also the format of the email notification to be sent to the recipients...
    CREATE OR REPLACE PROCEDURE check_reminder AS
    NO number;
    CURSOR emp_cur is
    select * from pergerakan_ks where TASK_FLAG=7 and TASK_STATUS='InProgress';
    emp_rec emp_cur%rowtype;
    email_to varchar2(200);
    default_email varchar2(200);
    mesg varchar2(4000);
    no_kes varchar2(100);
    subj varchar2(4000);
    kpi number;
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    BEGIN
    default_email:='@abc.com.my';
    FOR emp_rec in emp_cur
    LOOP
    if emp_rec.PKS_TKH_TERIMA is null then
    dbms_output.put_line('count day ' || round(sysdate - to_date(emp_rec.pks_tkh_hantar)) || crlf || crlf);
    if round(sysdate - to_date(emp_rec.pks_tkh_hantar)) >3 then
    email_to:=emp_rec.pks_penghantar_id||default_email;
    select b.KS_BIL_NO into no_kes from kertas_siasatan b where b.KS_ID = emp_rec.pks_ks_id;
    subj:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    mesg:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
    dbms_output.put_line('update old pergerakan pks_id : '||emp_rec.pks_id);
    update pergerakan_ks set task_status='Done' where pks_id=emp_rec.pks_id;
    dbms_output.put_line('insert new pergerakan ks : ');
    insert into pergerakan_ks(pks_id,pks_ks_id,pks_km_id,pks_penghantar_id,pks_tkh_hantar,
    pks_penerima_id,pks_tkh_terima,task_name,task_owner,task_status,task_flag,fb_id)
    values(pks_id_seq.nextval,emp_rec.pks_ks_id,emp_rec.pks_km_id,
    emp_rec.pks_penghantar_id,sysdate,
    null,
    null,emp_rec.task_name,
    emp_rec.pks_penghantar_id,
    'InProgress',6,emp_rec.fb_id);
    commit;
    e_mail_message(email_to,email_to,subj,mesg);
    end if;
    end if;
    if emp_rec.PKS_TKH_TERIMA is not null then
    dbms_output.put_line('emp_rec.pks_km_id ' || emp_rec.pks_km_id || crlf);
    select c.KM_KPI into kpi from keluar_masuk_ks c where c.KM_ID = emp_rec.pks_km_id;
    no := round(sysdate - to_date(emp_rec.pks_tkh_terima))-kpi;
    dbms_output.put_line('count day - kpi' || no || crlf);
    dbms_output.put_line('kpi ' || kpi || crlf);
    if no = 1 then
    email_to:=emp_rec.pks_penghantar_id||default_email;
    select b.KS_BIL_NO into no_kes from kertas_siasatan b where b.KS_ID = emp_rec.pks_ks_id;
    subj:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    mesg:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
    email_to:=emp_rec.task_owner||default_email;
    subj:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    mesg:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
    e_mail_message(email_to,email_to,subj,mesg);
    e_mail_message(email_to,email_to,subj,mesg);
    end if;
    if no = 3 then
    select b.KS_BIL_NO into no_kes from kertas_siasatan b where b.KS_ID = emp_rec.pks_ks_id;
    email_to:=emp_rec.task_owner||default_email;
    subj:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    mesg:='Reminder untuk Membuat Tindakan Bagi No Kes '||no_kes;
    dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
    e_mail_message(email_to,email_to,subj,mesg);
    end if;
    end if;
    END LOOP;
    END;
    E_mail_message is the stored procedure invoked by the check_reminder to tell scheduler information of the connection and the email address of the recipients...
    CREATE OR REPLACE procedure
    e_mail_message
    from_name in varchar2,
    to_name in varchar2,
    subject in varchar2,
    message in varchar2
    is
    l_mailhost VARCHAR2(64);
    l_from VARCHAR2(64);
    l_to VARCHAR2(64);
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    l_mail_conn UTL_SMTP.connection;
    mesg VARCHAR2( 4000 );
    BEGIN
    select a.SERVER into l_mailhost from email_setting a where a.SERVER is not null;
    select a.USERNAME into l_from from email_setting a where a.SERVER is not null;
    --UTL_SMTP.open_data(l_mail_conn);
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
    'From: <'||l_from||'>' || crlf ||
    'Subject: ' ||subject|| crlf ||
    'To: '||to_name || crlf || '' || crlf ;
    mesg:=mesg||message;
    l_mail_conn := UTL_SMTP.open_connection(l_mailhost, 25);
    UTL_SMTP.helo(l_mail_conn, l_mailhost);
    UTL_SMTP.mail(l_mail_conn, l_from);
    UTL_SMTP.rcpt(l_mail_conn, to_name);
    UTL_SMTP.data(l_mail_conn, mesg);
    UTL_SMTP.quit(l_mail_conn);
    END;
    I tried to execute to execute the e_mail_message procedure but received this error. Also, no notification sent to the email address...
    ORA-29279: SMTP permanent error: 501 5.1.3 Invalid address
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 241
    ORA-06512: at "ILMS.E_MAIL_MESSAGE", line 33
    ORA-06512: at line 13
    Please help so that I can receive the email notification into my email...thanks in advance for your time..

    user13281540 wrote:
    ORA-29279: SMTP permanent error: 501 5.1.3 Invalid address
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 241
    ORA-06512: at "ILMS.E_MAIL_MESSAGE", line 33
    ORA-06512: at line 13This is not an Oracle error - this is the mail server saying "+hey, I don't like that e-mail address you are supplying, I'm not accepting it!+".
    If you look at RFC821 (Request For Comments memo 821 describes the SMTP specifications), you'll see that the sender and recipient needs to be supplied in the format +<[email protected]>+, e.g. +<[email protected]>+.
    I have found that not all SMTP servers are equal in this regard. Some may insist on the brackets around the address, some may not.
    You need to confirm the format of the addresses you use in the "+MAIL FROM+" and "+RCPT TO+" commands.. and ensure that these formats are accepted by your SMTP server - and if not, change your code to use an acceptable format.
    The easiest way to do this is using telnet - and interacting directly and manually with the server. SMTP is a clear text protocol and easy to use manually. Try it. It is the best way to test SMTP interaction and validate the approach and SMTP commands and arguments used by your code.

  • Send email with attachments from oracle procedure

    This is my procedure
    CREATE OR REPLACE PROCEDURE send_parvo_email IS
    v_header varchar2(200);
    v_file UTL_FILE.FILE_TYPE;
    v_count Number;
    v_letter Varchar(50);
    req UTL_HTTP.REQ;
    req1 UTL_HTTP.REQ;
    resp UTL_HTTP.RESP;
    resp1 UTL_HTTP.RESP;
    url VARCHAR2 (2000);
    url1 VARCHAR2 (2000);
    val varchar2(4000);
    val1 varchar2(4000);
    p_start_date DATE;
    p_end_date DATE;
    v_shipment_id varchar2(30);
    --v_start_date  DATE;
    --v_end_date DATE;
    Cursor C1 is select shipment_id
    from ship_hdr
    where trunc(create_time) = trunc(sysdate);
    BEGIN
    v_letter := 'r_parvo_b19_rpt';
    select trunc(sysdate-7),trunc(sysdate-2)
    into p_start_date,p_end_date
    from dual;
    Open C1;
    Fetch C1 into v_shipment_id;
    Close C1;
    save_parvo_email;
    UTL_HTTP.SET_PROXY (null,null);
    url :=
    utl_url.ESCAPE
    ( 'http://hbc-maroon.heartlandbc.org/reports/rwservlet?userid=test/[email protected]&subject="Parvo Testing Report"&destype=mail&FROM=[email protected]&desname=[email protected]&desformat=PDF&ENVID=QA&report='||v_letter||'&start_date='||p_start_date||'&end_date='||p_end_date);
    req := UTL_HTTP.BEGIN_REQUEST (url);
    UTL_HTTP.SET_HEADER (req, 'User-Agent', 'Mozilla/4.0 Oracle');
    resp := UTL_HTTP.GET_RESPONSE (req);
    UTL_HTTP.READ_LINE (resp, val, TRUE);
    UTL_HTTP.END_RESPONSE (resp);
    Update ship_dtl
    set shipment_printed = 'Y'
    where shipment_printed is null
    and trunc(coll_date) between p_start_date and p_end_date;
    commit;
    END;
    This works fine and sends email with the report as attachment. The attachment is report_name.pdf. I want to change this attachment to be named as shipment_id.pdf. Is this possible and how?
    If there is any other method to sent email with attachments . ie run the report and attach the report to the email not as report_name.rdf but shipmenmt_id.rdf

    This is my procedure
    CREATE OR REPLACE PROCEDURE send_parvo_email IS
    v_header varchar2(200);
    v_file UTL_FILE.FILE_TYPE;
    v_count Number;
    v_letter Varchar(50);
    req UTL_HTTP.REQ;
    req1 UTL_HTTP.REQ;
    resp UTL_HTTP.RESP;
    resp1 UTL_HTTP.RESP;
    url VARCHAR2 (2000);
    url1 VARCHAR2 (2000);
    val varchar2(4000);
    val1 varchar2(4000);
    p_start_date DATE;
    p_end_date DATE;
    v_shipment_id varchar2(30);
    --v_start_date  DATE;
    --v_end_date DATE;
    Cursor C1 is select shipment_id
    from ship_hdr
    where trunc(create_time) = trunc(sysdate);
    BEGIN
    v_letter := 'r_parvo_b19_rpt';
    select trunc(sysdate-7),trunc(sysdate-2)
    into p_start_date,p_end_date
    from dual;
    Open C1;
    Fetch C1 into v_shipment_id;
    Close C1;
    save_parvo_email;
    UTL_HTTP.SET_PROXY (null,null);
    url :=
    utl_url.ESCAPE
    ( 'http://hbc-maroon.heartlandbc.org/reports/rwservlet?userid=test/[email protected]&subject="Parvo Testing Report"&destype=mail&[email protected]&[email protected]&desformat=PDF&ENVID=QA&report='||v_letter||'&start_date='||p_start_date||'&end_date='||p_end_date);
    req := UTL_HTTP.BEGIN_REQUEST (url);
    UTL_HTTP.SET_HEADER (req, 'User-Agent', 'Mozilla/4.0 Oracle');
    resp := UTL_HTTP.GET_RESPONSE (req);
    UTL_HTTP.READ_LINE (resp, val, TRUE);
    UTL_HTTP.END_RESPONSE (resp);
    Update ship_dtl
    set shipment_printed = 'Y'
    where shipment_printed is null
    and trunc(coll_date) between p_start_date and p_end_date;
    commit;
    END;
    This works fine and sends email with the report as attachment. The attachment is report_name.pdf. I want to change this attachment to be named as shipment_id.pdf. Is this possible and how?
    If there is any other method to sent email with attachments . ie run the report and attach the report to the email not as report_name.rdf but shipmenmt_id.rdf

  • Sending email from within a stored procedure

    Is it possible to send and email within a stored procedure written in PL/SQL. I have searched this site and the web for an Oracle package which simulates a mail agent written in PL/SQL, but I have not had any success.
    null

    Well, on NT one way we did it was to link to kernel32.dll so we could execute OS commands (WinExec), and did the email that way.
    Here's a bit of script to try:
    connect sys/@db;
    drop library kernellib;
    CREATE LIBRARY kernellib as 'c:\winnt\system32\kernel32.dll';
    show errors
    CREATE OR REPLACE PACKAGE UTIL IS
    function run(lpCmdLine IN varchar2, nCmdShow IN binary_integer) return binary_integer;
    end;
    show errors
    CREATE OR REPLACE PACKAGE BODY UTIL IS
    function run(lpCmdLine IN varchar2, nCmdShow IN binary_integer) return binary_integer
    AS EXTERNAL
    NAME "WinExec"
    LIBRARY kernellib
    parameters (lpCmdLine STRING, nCmdShow long);
    end;
    show errors
    Then you just call util.run() with an appropriate command line to send email. Bit of a hack, but it depends on what you want to do with it. Another hack would be to use the UTL_HTTP package to submit a form to your web server and use a CGI program to send the email.

  • Error when I run procedure to send email

    Hi,
    I tried to send email with stored procedure.
    It run correctly just I connect with system/manager.
    If I change user/password don't run my procedure and I see this error:
    ERROR at line 1:
    ORA-29540: class oracle/plsql/net/TCPConnection does not exist
    ORA-06512: at "SYS.UTL_TCP", line 533
    ORA-06512: at "SYS.UTL_TCP", line 199
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 121
    ORA-06512: at "AFM.SPEDISCI_MAIL", line 17
    ORA-06512: at line 1
    is normal???
    i run this scripts (as internal/oracle - sys/change_on_install - myuser/password):
    @c:\oracle\ora81\rdbms\admin\initplsj.sql
    @c:\oracle\ora81\j avavm\install\initjvm.sql
    @c:\oracle\ora81\javavm\install\init_security.sql
    thanks!!!
    Raffaele

    I'm sure someone will give more detail, but it looks like the server blocked your address because it thinks it's a spam source.  If you're not spamming, then it might be someone on the same network spamming, or malware on your computer doing it.  Or it could just be a mistake.  try calling whoever runs your mail server and see if they can give you more information.

  • Procedure for Sending Emails with Attachments

    Hi All,
    Q1. We wish to write a PROCEDURE that sends emails with attachments in SQL. Can someone please suggest the procedure code for the same?
    Q2. Apart from DBMS_JOB utlity can any other this procedure be scheduled to send automatic emails picking up files from a remote filer randomly.
    Regards,
    Chinmay

    http://www.lv2000.com/articles/utlsmtp.htm
    I do not understand what the article is trying to say when it says this:
    <quote>
    1. You cannot send a Subject line with your email.
    2. You cannot add attachments to your message.
    Hopefully, these two deficiencies will be rectified in future releases!
    </quote>
    The entire email sending code with attachments is freely available from Oracle (sitting on top of utl_smtp package). No need to buy additional software.

  • Send email from the server

    I need to send email from the database.
    Two ways that I am familiar with -
    1. using VB/ODBC controls;
    2. dbms_pipe
    Anyone knows a more 'direct' solution?
    Regards
    Anatoliy Smirnov
    null

    by the way how can u send attchments with mails from database.
    chetan
    try this...(thanks for the subject line help)
    the first message line will be read by non MIME compliant readers, the second message line with be in the body of the note, the nest 2 (third and fourth) will come in as attachments ( text ). Change the Content-type for things like word docs or other 8bit docs (Content-type: application/msword) and write_raw_data for the 8Bit parts
    CREATE OR REPLACE PROCEDURE send_mail_test (sender IN VARCHAR2,
    recipient IN VARCHAR2, subject IN VARCHAR2,
    message IN VARCHAR2)
    IS
    mailhost VARCHAR2(30) := 'smtp.naxs.net';
    mail_conn utl_smtp.connection;
    cv_cCRLF VARCHAR2(10) := UTL_TCP.CRLF;
    lv_message varchar2(4000);
    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,'From: ' | | sender | | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'To: ' | | recipient | | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'Subject:' | | subject | | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'MIME-Version: 1.0' | | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'Content-Type: multipart/mixed; ');
    utl_smtp.write_data(mail_conn,'boundary="NextPart_000_01C002D3.EB460626"' | | cv_cCRLF);
    utl_smtp.write_data(mail_conn, cv_cCRLF | | message| |' first mess part'| | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'--NextPart_000_01C002D3.EB460626' | | cv_cCRLF);
    utl_smtp.write_data(mail_conn, cv_cCRLF | | message| | ' second mess part'| | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'--NextPart_000_01C002D3.EB460626' | | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'Content-Type: text/plain; charset=us-ascii'| | cv_cCRLF);
    utl_smtp.write_data(mail_conn, cv_cCRLF | | message| | ' third mess part'| |cv_cCRLF);
    utl_smtp.write_data(mail_conn,'--NextPart_000_01C002D3.EB460626' | | cv_cCRLF);
    utl_smtp.write_data(mail_conn,'Content-Type: text/plain; charset=us-ascii'| | cv_cCRLF);
    utl_smtp.write_data(mail_conn, cv_cCRLF | | message| | ' fourth mess part'| |cv_cCRLF);
    utl_smtp.write_data(mail_conn,'--NextPart_000_01C002D3.EB460626--' | | cv_cCRLF);
    utl_smtp.close_data(mail_conn);
    -- utl_smtp.data(mail_conn, message);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN OTHERS
    THEN
    DECLARE
    error_code NUMBER := SQLCODE;
    error_msg VARCHAR2(2000) := SQLERRM;
    error_info VARCHAR2(30);
    BEGIN
    DBMS_OUTPUT.PUT_LINE('We have an error: '| |error_code| |' '| |error_msg);
    END;
    END;
    show errors;
    null

  • Cannot send email notification to more than one people

    Hi everyone,
    Hope anyone could help me to solve this. I want to send email notification to two people. First to the staff to alert him that his claim is ready. And also to his supervisor that the claim has been disbursed. Below is the PL/SQL procedure, check_claim being used..
    CREATE OR REPLACE PROCEDURE TEST.check_claim AS
    NO number;
    CURSOR emp_cur is
    select * from emp where dept=7 and status='active';
    emp_rec emp_cur%rowtype;
    email_to varchar2(200);
    default_email varchar2(200);
    mesg varchar2(4000);
    subj varchar2(4000);
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    BEGIN
    default_email:='@phantom.com';
    FOR emp_rec in emp_cur
    LOOP
    if emp_rec.claim_status ='Y' then
    email_to:=emp_rec.staff_id||default_email;
    subj:='Claim No'||emp_rec.claim_id;
    mesg:='Your claim has been disbursed. Please check.';
    email_to:=emp_rec.staff_hod||default_email;
    subj:='Claim'||emp_rec.claim_id;
    mesg:='Claim No'||emp_rec.claim_id||' has been disbursed';
    e_mail_message(email_to,email_to,subj,mesg);
    e_mail_message(email_to,email_to,subj,mesg);
    end if;
    END LOOP;
    END;
    The first email_to is to be sent to staff_id and the second email_to is to be sent to staff_hod.
    The PL/SQL procedure then called the e_mail_message procedure shown below for the connection information..
    CREATE OR REPLACE procedure
    TEST.e_mail_message
    from_name in varchar2,
    to_name in varchar2,
    subject in varchar2,
    message in varchar2
    is
    l_mailhost VARCHAR2(64);
    l_from VARCHAR2(64);
    l_to VARCHAR2(64);
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    l_mail_conn UTL_SMTP.connection;
    mesg VARCHAR2( 4000 );
    BEGIN
    select a.SERVER into l_mailhost from email_setting a where a.SERVER is not null;
    select a.USERNAME into l_from from email_setting a where a.SERVER is not null;
    --UTL_SMTP.open_data(l_mail_conn);
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
    'From: <'||l_from||'>' || crlf ||
    'Subject: ' ||subject|| crlf ||
    'To: '||to_name || crlf || '' || crlf ;
    mesg:=mesg||message;
    l_mail_conn := UTL_SMTP.open_connection(l_mailhost, 25);
    UTL_SMTP.helo(l_mail_conn, l_mailhost);
    UTL_SMTP.mail(l_mail_conn, l_from);
    UTL_SMTP.rcpt(l_mail_conn, to_name);
    UTL_SMTP.data(l_mail_conn, mesg);
    UTL_SMTP.quit(l_mail_conn);
    END;
    However, the email notification only being sent to the supervisor / head of department. The staff concerned does not receive any email notification. Please help. Thank you for your time...

    from wht i see
    email_to:=emp_rec.staff_id||default_email;
    subj:='Claim No'||emp_rec.claim_id;
    mesg:='Your claim has been disbursed. Please check.';
    email_to:=emp_rec.staff_hod||default_email;  -- wrongit should be
    email_to:=emp_rec.staff_id||default_email;
    subj:='Claim No'||emp_rec.claim_id;
    mesg:='Your claim has been disbursed. Please check.';
    email_to:= email_to || ' , ' ||  emp_rec.staff_hod||default_email;

  • Cannot send email to one particular address

    I've lost the ability to send emails to my work email address, it seems to have stopped working in the last 30 days or so. I can receive emails from the work address to my personal address, but sending from the personal address to work doesn't work. The emails are not returned as undeliverable. I have Verizon FIOS as my provider, I have tried sending email to my work address from their web email interface and it works fine, so the problem lies in Thunderbird. Anyone have an idea what has happened? I'm not having an issue sending or receiving to any other address.

    ''Matt [[#answer-667247|said]]''
    <blockquote>
    It is just a shame Verizon employ support that is not.
    Sending from Thunderbird uses a completely different set of protocols and procedures to web mail.
    Sending from Thunderbird is analogous to sending snail mail by dropping it in a pillar box in your street corner. Sending using web mail is more like going to the local mail sorting house and dropping the mail into the truck delivering to the city your sent your mail to.
    In my analogy there is one huge difference, your anti virus program does not scan outgoing web mails, it does not even see them as mails. The same goes for incoming mail.
    So when support people start blaming outlook or Thunderbird and saying it must be the problem, what they are really saying is they actually know nothing more about mail than you do, they have arrived at the end of their script and your have no resolution, so please go away.
    We try to do a little better here, but sometimes we can't. Verizon have access to the outgoing servers, they could tell you if your mail ever actually leaves their system, we can only guess.
    So what is the mail server your sending to? Is the outgoing mail address your work one?
    When you right click on the account name in the folder tree and select settings. On the bottom right is the outgoing SMTP server for the account. Is it what your think it is?
    </blockquote>
    The outgoing mail address is to my work email, it's @us.ibm.com, I checked the SMTP server name, it is outgoing.verizon.net which is correct.
    You're right about Verizon support, once I was able to send via their web interface, they were pretty much done with me....and I pay for that support too...
    This is probably going to end up being something simple, at least i hope so, but at the moment it's very frustrating...

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

  • APEX SEND EMAIL FUNCTION NOT SENDING EMAIL

    Hi All,
    For some reason that I can't figure out is not send any email... Could yo please help me to find it?
    DECLARE
    CreationDate date;
    ClosureDate date;
    IncidentsQty NUMBER;
    Tool varchar(100);
    BEGIN
    SELECT COUNT(STUCK_RELATED_TO_PROBLEM) into IncidentsQty
    FROM INCIDENTS
    WHERE STUCK_RELATED_TO_PROBLEM = :P57_INCIDENT_ID;
    SELECT IDATE  INTO CreationDate
    FROM PROBLEMS
    WHERE ID = :P57_INCIDENT_ID;
    SELECT CDATE  INTO ClosureDate
    FROM PROBLEMS
    WHERE ID = :P57_INCIDENT_ID;
    SELECT TOOL  INTO Tool
    FROM PROBLEMS
    WHERE ID = :P57_INCIDENT_ID;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    APEX_MAIL.send(
    p_to =>  '[email protected]',
    p_from => :app_user,
    p_body => 'SERVICE DESK NOTIFICATIONS: NEW UPDATE HAS BEEN REPORTED INTO AN PROBLEM',
    p_body_html => '<p>The details of the problem closed are the following: <br>
    <p>Creation date: ' || CreationDate || ' <br>
    Closure date:  '|| ClosureDate ||'<br>
    Incidents Qty: '|| IncidentsQty ||'<br>
    Observations: '|| :P57_IUPDATE ||'</p><br>
    p_SUBJ => 'The problem for the tool ' || TOOL || ' (ID# '|| :P57_INCIDENT_ID ||') has been closed.',
    p_cc => '',
    p_bcc => NULL ,
    p_replyto => NULL
    END;

    Hello Bernardo,
    >
    For some reason that I can't figure out is not send any email... Could yo please help me to find it?
    >
    Please do provide necessary information so the picture about your problem is clear for the forum members.
    The blog post by one of the eminent person working with Oracle Technologies @Tom Kyte might help:
    http://tkyte.blogspot.in/2005/06/how-to-ask-questions.html
    Now coming to your posted procedure snippet:
    APEX_MAIL.send (
    p_to =>  '[email protected]',
    p_from => :app_user,
    p_body => 'SERVICE DESK NOTIFICATIONS: NEW UPDATE HAS BEEN REPORTED INTO AN PROBLEM',
    p_body_html => '<p>The details of the problem closed are the following: <br>
    <p>Creation date: ' || CreationDate || ' <br>
    Closure date:  '|| ClosureDate ||'<br>
    Incidents Qty: '|| IncidentsQty ||'<br>
    Observations: '|| :P57_IUPDATE ||'</p><br>',
    p_SUBJ => 'The problem for the tool ' || TOOL || ' (ID# '|| :P57_INCIDENT_ID ||') has been closed.',
    p_cc => '',
    p_bcc => NULL ,
    p_replyto => NULL
    );As you have not given APEX Version information I will go with APEX Version Application Express 4.2.0.00.27.
    I would recommend you to go through the documentation of [url http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_mail.htm#CIHDIEJI]APEX_MAIL to help you debug the problem.
    This is what i want you to check with your email configuration:
    <ul>
    <li>Have you configured the email settings on the Instance Settings page.
    Refer: http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35129/adm_mg_service_set.htm#BEJBCEEH</li>
    <li>Have you checked the configuration works fine? You can use the examples given in the documentation of APEX_MAIL.SEND Procedure.
    Refer: http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_mail.htm#CHDDAAJE
    Note: User SQL Commands from your APEX Workspace for this purpose.
    Also after sending email check for the error in APEX_MAIL_QUEUE or APEX_MAIL_LOG using query:
    -- Check whether the mail has been queued
    SELECT *
       FROM APEX_MAIL_QUEUE;
    -- Push the mail for delivery
    BEGIN
      APEX_MAIL.PUSH_QUEUE;
    END;
    -- Check whether the mail has been delivered without any error
    -- check for MAIL_SEND_ERROR column
    SELECT *
       FROM APEX_MAIL_LOG;</li>
    <li>Are you using Oracle Database Release 11.1 or higher version ? If yes then you have to configure network services to enable the host to send email. Refer: http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/sec_admin_ssl.htm#HTMDB12006</li>
    <li>Are you invoking the APEX_MAIL procedures through a database package? If yes then you have to set the SECURITY_GROUP_ID.
    Refer the starting of APEX_MAIL documentation.
    Use the following code before invoking APEX_MAIL procedures:
    p_app_id should be the Application Number of your APEX application.
    for c1 in (
       select workspace_id
         from apex_applications
        where application_id = p_app_id )
    loop
       apex_util.set_security_group_id(p_security_group_id =>
    c1.workspace_id);
    end loop;</li>
    </ul>
    This is what i find doubting about the code snippet:
    <ul>
    <li>Is APP_USER passing valid email ID?</li>
    <li>Note the usage of utl_tcp.crlf in the APEX_MAIL.SEND procedure examples in the documentation.</li>
    <li>Why have you passed empty string to the parameter p_cc ? Note that empty string is not equal to NULL.</li>
    <li>Instead of passing data directly to the parameters you can use variables, assign data to variables and pass variables instead.</li>
    </ul>
    In order to get accurate/appropriate response you should include at least following information with your question:
    <ul>
    <li>Full APEX version</li>
    <li>Full Database version</li>
    <li>APEX Web server architecture (EPG, OHS or APEX listener)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Operating system with version, architecture(32/64)</li>
    </ul>
    The above information will help the forum members to ascertain the problem context and post most relevant response.
    Please read the [url https://wikis.oracle.com/display/Forums/Forums+FAQ]FAQ and [url https://forums.oracle.com/forums/ann.jspa?annID=1324]forum instructions for more information on using OTN forums effectively.
    Please perform a [url https://forums.oracle.com/forums/search!default.jspa]forum search before posting a question as this will help reduce duplicate threads.
    Please mark the reply as helpful or correct as this will help other members on the forum with similar question.
    Hope it helps!
    Regards,
    Kiran

  • Sending email using UTL_SMTP

    Dear experts,
    I am trying to send an email using UTL_SMTP (i switched from UTL_MAIL to UTL_SMTP since i need to send mails with large attachments - BLOB). I am using the demo_mail package given here:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    While running the program I am getting an error message (from the error.log) saying:
    [Mon Aug 04 14:00:21 2008] [error] [client 192.168.0.7] mod_plsql: /ns/email_p.send HTTP-404 ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. 9sm12723808qbw.6\nORA-06512: at "SYS.UTL_SMTP", line 20\nORA-06512: at "SYS.UTL_SMTP", line 98\nORA-06512: at "SYS.UTL_SMTP", line 221\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 258\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 119\nORA-06512: at "NEXTSTEP.EMAIL_P", line 33\nORA-06512: at line 31\n, referer: file:///C:/Documents and Settings/Mayank/My Documents/Flex Builder 3/ns5/bin-debug/main.swf
    My code is as follows:
    PACKAGE DECLARATION. This is the DEMO_MAIL package posted under above link (I have renamed it).
    CREATE OR REPLACE PACKAGE NEXTSTEP.send_email_helper IS
      ----------------------- Customizable Section -----------------------
      -- Customize the SMTP host, port and your domain name below.
        smtp_host   VARCHAR2(256) := 'smtp.gmail.com';
        smtp_port   PLS_INTEGER   := 587;
        smtp_domain VARCHAR2(256) := null;
      -- Customize the signature that will appear in the email's MIME header.
      -- Useful for versioning.
      MAILER_ID   CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
      --------------------- End Customizable Section ---------------------
      -- A unique string that demarcates boundaries of parts in a multi-part email
      -- The string should not appear inside the body of any part of the email.
      -- Customize this if needed or generate this randomly dynamically.
      BOUNDARY        CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
      FIRST_BOUNDARY  CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
      LAST_BOUNDARY   CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
                                                  utl_tcp.CRLF;
      -- A MIME type that denotes multi-part email (MIME) messages.
      MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
                                                      BOUNDARY || '"';
      MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER   := 76 / 4 * 3;
      -- A simple email API for sending email in plain text in a single call.
      -- The format of an email address is one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      -- The recipients is a list of email addresses  separated by
      -- either a "," or a ";"
      PROCEDURE mail(sender     IN VARCHAR2,
             recipients IN VARCHAR2,
             subject    IN VARCHAR2,
             message    IN VARCHAR2);
      -- Extended email API to send email in HTML or plain text with no size limit.
      -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
      -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
      -- email in non-ASCII or multi-byte character set. End the email with
      -- end_mail().
      FUNCTION begin_mail(sender     IN VARCHAR2,
                  recipients IN VARCHAR2,
                  subject    IN VARCHAR2,
                  mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                  priority   IN PLS_INTEGER DEFAULT NULL)
                  RETURN utl_smtp.connection;
      -- Write email body in ASCII
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
      -- Write email body in non-ASCII (including multi-byte). The email body
      -- will be sent in the database character set.
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                  message IN            VARCHAR2);
      -- Write email body in binary
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                  message IN RAW);
      -- APIs to send email with attachments. Attachments are sent by sending
      -- emails in "multipart/mixed" MIME format. Specify that MIME format when
      -- beginning an email with begin_mail().
      -- Send a single text attachment.
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                data         IN VARCHAR2,
                mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                inline       IN BOOLEAN  DEFAULT TRUE,
                filename     IN VARCHAR2 DEFAULT NULL,
                    last         IN BOOLEAN  DEFAULT FALSE);
      -- Send a binary attachment. The attachment will be encoded in Base-64
      -- encoding format.
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                  data         IN RAW,
                  mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                  inline       IN BOOLEAN  DEFAULT TRUE,
                  filename     IN VARCHAR2 DEFAULT NULL,
                  last         IN BOOLEAN  DEFAULT FALSE);
      -- Send an attachment with no size limit. First, begin the attachment
      -- with begin_attachment(). Then, call write_text repeatedly to send
      -- the attachment piece-by-piece. If the attachment is text-based but
      -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
      -- To send binary attachment, the binary content should first be
      -- encoded in Base-64 encoding format using the demo package for 8i,
      -- or the native one in 9i. End the attachment with end_attachment.
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                     mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     transfer_enc IN VARCHAR2 DEFAULT NULL);
      -- End the attachment.
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
      -- End the email.
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
      -- Extended email API to send multiple emails in a session for better
      -- performance. First, begin an email session with begin_session.
      -- Then, begin each email with a session by calling begin_mail_in_session
      -- instead of begin_mail. End the email with end_mail_in_session instead
      -- of end_mail. End the email session by end_session.
      FUNCTION begin_session RETURN utl_smtp.connection;
      -- Begin an email in a session.
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                      sender     IN VARCHAR2,
                      recipients IN VARCHAR2,
                      subject    IN VARCHAR2,
                      mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                      priority   IN PLS_INTEGER DEFAULT NULL);
      -- End an email in a session.
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
      -- End an email session.
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;How should I solve the above error? Can anyone help me with my query please?
    If I add the code to start TLS it still gives me an error. If I add the code
    utl_smtp.command(conn,'STARTTLS');
    utl_smtp.helo(conn, smtp_domain);
    under email_sender_help package just before under begin_session function, it gives me an error saying:
    ORA-29279: SMTP permanent error: 503 5.5.1 EHLO/HELO first. s27sm2097329qbs.12
    So then if i enter the same code after:
    utl_smtp.command(conn,'STARTTLS');
    utl_smtp.helo(conn, smtp_domain);
    It gives me an error:
    ORA-29278: SMTP transient error: 421 Service not available
    Message was edited by:
    Monk
    Message was edited by:
    Monk

    look like rely turned off on the server..
    check this.. or ask your network guys..
    Go to Control Panel->Add or Remove Programs->Click on
    Add/Remove Wndows Components
    Check IIS check box.
    Select Internet Information Service (IIS) option and click on Details button
    Check whether SMTP Service is checked or not.
    If not selected then select SMTP check box.
    This process should be done on server.
    It will help out from ORA-29278: SMTP transient error: 421 Service not available problem.
    thanks

  • Apex 4: How to send email when form is submitted?

    Hi,
    Using Apex 4.0.2 on DB 11g, I've a form with around 80 fields and 4 check boxes.
    When the user clicks on submit button, besides saving the values in the database I also have to send emails. Selection of the 4 check boxes decides whom the email has to go to, i.e if 2 check boxes are checked, send 2 emails.
    In the emails, some contents will be based on the data the user has filled and some from the database; also data in different emails will be different.
    From what I've read, to send email I've to use APEX_MAIL API and make a conditional process depending on the check boxes selected. Also that I have configure mail server in database and that mail sever has to accept autonomous user (i.e. sending email without password)
    Is this the right approach?
    How can I do this?
    Is there any example/tutorial that will guide me in doing this?
    Thank you for your time.

    The Apex email package is very simple.
    v_id := apex_mail.send(
              p_to        => v_to,
              p_from      => v_from,
              p_subj      => v_subject,
              p_body      => v_body,
              p_body_html => v_html);It's up to you how you get the values of the variables.
    Also that I have configure mail server in database and that mail sever has to accept autonomous userThe mail server is not in the database, but you do have to inform Apex which server to use (smtp.yourcompany.com).
    Most smtp servers require user and password. In that case you have to write your own procedure. Search the pl/sql forum for email authentication and you will find many examples.
    It is probably also possible to configure the smtp server in such a way that requests coming from the database do not need authentication. That is how we have it configured (but I don't know how the administrator did it, though).

  • 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

Maybe you are looking for

  • How to leave Verizon after contract ends - taking with me the phone number?

    My contract is about to end - Nov. 5 - and I want to port the number over to an entirely new phone, which will use Straight Talk. Do I let the contract expire, then port the number? Or do I port the number first, then let it expire? It's not clear wh

  • SPROXY unable to get Interface meta-data from XI Server

    Hi, In our SAP R/3 Enterprise system, the transaction SPROXY complains that "No connection to Integration Builder (only local data visible)".  It is unable to get the message interfaces defined in the SAP XI Server. Connection to SLD is configured co

  • Files locked or in use

    Suddenly tons of Word Processor document in AppleWork 6.2.9 don't open. A message says: "This file is locked or in use. Would you like to open a copy of it?" Someone has a suggestion about what I may have done or what is going on, and how to resolve

  • Write to access

    does any one have example " write and read to access database " which is written in labview 8.5 i would be very thankful thanks

  • Why won't After Effects boot after installing Flash 10?

    Since installing Flash 10 this morning, other Adobe Products (After Effects and Audition) fail to initialize media core and won't boot.  Photoshop boots okay.  Deleting Preference File in AE didn't help.  Restored OS to two days ago.  No help. Vista