Oracle package to send mail

I've this package to send mail:
CREATE OR REPLACE Package PKG_ALERT     IS
procedure PROC_ALERT;
procedure SEND_ALERT (sender IN varchar2,
                          recipient1 IN varchar2,
                          recipient2 IN varchar2,
                          recipient3 IN varchar2,
                          subject IN varchar2,
                          messaggio IN varchar2);
END PKG_AFM_ALERT;
CREATE OR REPLACE Package Body PKG_AFM_ALERT     IS
procedure PROC_ALERT      is
v_appo number;
send_msg varchar2(2000);
BEGIN
    SELECT COUNT(*)
    INTO V_APPO
    FROM MY_TAB
    WHERE STATUS='2'
    AND TIPO NOT IN ('0')
    AND DATA_INS >= TRUNC(SYSDATE)- 4;
          IF V_APPO > 0  THEN
             SEND_ALERT ('[email protected]',
               '[email protected]',
               '[email protected]',
               '[email protected]',
               'my subject',
            'Test';
          END IF;
END PROC_ALERT;
PROCEDURE SEND_ALERT (sender IN varchar2,
                          recipient1 IN varchar2,
                          recipient2 IN varchar2,
                          recipient3 IN varchar2,
                          subject IN varchar2,
                          messaggio IN varchar2)
   IS
    mailhost varchar2(40):= 'my mailhost';
    conn     utl_smtp.connection;
    crlf     varchar2(2):=CHR(13)||CHR(10);
    messag     varchar2(32767);
    v_sender varchar2(2000) := sender;
    cursor riga is
    SELECT EM_NUMBER, FLAG_CID_RIFERIMENTO, STATUS, TIPO, BL_ID, FL_ID, RM_ID, DATA_INS
    FROM MY_TAB
    WHERE STATUS='2'
    AND TIPO NOT IN ('0');
BEGIN
  conn := utl_smtp.open_connection (mailhost, 25);
  messag := 'DATE: '||to_char(sysdate, 'dd-mon-yy hh24:mi:ss')||crlf||
       'FROM: <'||sender||'>'||crlf||
     'SUBJECT: '||subject||crlf||
       'TO: '||recipient1||';  '||recipient2||';  '||recipient3;
  messag := messag||crlf||RPAD('EM_NUMBER',10)||RPAD('STATUS',10)||RPAD('TIPO',10)||RPAD('BL_ID',10)||RPAD('FL_ID',8)||RPAD('RM_ID',8)||RPAD('DATA_INS',15);
  for rec_msg in riga
  loop
    messag := messag||crlf||RPAD(rec_msg.EM_NUMBER,10)||RPAD(rec_msg.STATUS,10)||RPAD(rec_msg.TIPO,10)||RPAD(rec_msg.BL_ID,10)||RPAD(rec_msg.FL_ID,8)||RPAD(rec_msg.RM_ID,8)||RPAD(rec_msg.DATA_INS,15);
   end loop;
  utl_smtp.helo(conn, mailhost);
  utl_smtp.mail (conn, v_sender);
  utl_smtp.rcpt (conn, recipient1);
  utl_smtp.rcpt (conn, recipient2);
  utl_smtp.rcpt (conn, recipient3);
  utl_smtp.data(conn, messag||crlf||crlf||nvl(messaggio,'-'));
  utl_smtp.quit(conn);
EXCEPTION
when utl_smtp.transient_error or utl_smtp.permanent_error  then
  utl_smtp.quit(conn);
  raise_application_error (-20000, 'mail error: '||sqlerrm);
END SEND_ALERT;
END PKG_ALERT;It run correctly (execute PKG_ALERT.PROC_ALERT;)
Now I'd like to insert my address list ([email protected], .....) in a table so if they change addresses, I only change them in the table.
How can I rewrite the procedure PROC_ALERT to take the addresses list from this table?
Thanks in advance!

I tried this:
  CREATE TABLE EMAIL_ADDRESS_LIST
   (EMAIL_ADDRESS VARCHAR2(64),
    ACTIVE  CHAR(1)
CREATE OR REPLACE Package PKG_ALERT     IS
procedure PROC_ALERT;
procedure SEND_ALERT (sender IN varchar2,
                          recipient1 IN varchar2,
                          recipient2 IN varchar2,
                          recipient3 IN varchar2,
                          subject IN varchar2,
                          messaggio IN varchar2);
END PKG_AFM_ALERT;
CREATE OR REPLACE Package Body PKG_AFM_ALERT     IS
procedure PROC_ALERT      is
v_appo number;
send_msg varchar2(2000);
  CURSOR C_RECIPIENTS IS
  SELECT EMAIL_ADDRESS
    FROM EMAIL_ADDRESS_LIST
WHERE ACTIVE='Y';
BEGIN
  FOR R IN C_RECIPIENTS LOOP
    SELECT COUNT(*)
    INTO V_APPO
    FROM MY_TAB
    WHERE STATUS='2'
    AND TIPO NOT IN ('0')
    AND DATA_INS >= TRUNC(SYSDATE)- 4;
          IF V_APPO > 0  THEN
             SEND_ALERT ('[email protected]',
                recipient1 => R.EMAIL_ADDRESS ,
                   recipient2 => R.EMAIL_ADDRESS ,
                   recipient3 => R.EMAIL_ADDRESS ,
                   subject => 'my subject',
                   MESSAGGIO => 'Test');
          END IF;
END LOOP;
END PROC_ALERT;
PROCEDURE SEND_ALERT (sender IN varchar2,
                          recipient1 IN varchar2,
                          recipient2 IN varchar2,
                          recipient3 IN varchar2,
                          subject IN varchar2,
                          messaggio IN varchar2)
   IS
    mailhost varchar2(40):= 'my mailhost';
    conn     utl_smtp.connection;
    crlf     varchar2(2):=CHR(13)||CHR(10);
    messag     varchar2(32767);
    v_sender varchar2(2000) := sender;
    cursor riga is
    SELECT EM_NUMBER, FLAG_CID_RIFERIMENTO, STATUS, TIPO, BL_ID, FL_ID, RM_ID, DATA_INS
    FROM MY_TAB
    WHERE STATUS='2'
    AND TIPO NOT IN ('0');
BEGIN
  conn := utl_smtp.open_connection (mailhost, 25);
  messag := 'DATE: '||to_char(sysdate, 'dd-mon-yy hh24:mi:ss')||crlf||
       'FROM: <'>'||crlf||
     'SUBJECT: '||subject||crlf||
       'TO: '||recipient1||';  '||recipient2||';  '||recipient3;
  messag := messag||crlf||RPAD('EM_NUMBER',10)||RPAD('STATUS',10)||RPAD('TIPO',10)||RPAD('BL_ID',10)||RPAD('FL_ID',8)||RPAD('RM_ID',8)||RPAD('DATA_INS',15);
  for rec_msg in riga
  loop
    messag := messag||crlf||RPAD(rec_msg.EM_NUMBER,10)||RPAD(rec_msg.STATUS,10)||RPAD(rec_msg.TIPO,10)||RPAD(rec_msg.BL_ID,10)||RPAD(rec_msg.FL_ID,8)||RPAD(rec_msg.RM_ID,8)||RPAD(rec_msg.DATA_INS,15);
   end loop;
  utl_smtp.helo(conn, mailhost);
  utl_smtp.mail (conn, v_sender);
  utl_smtp.rcpt (conn, recipient1);
  utl_smtp.rcpt (conn, recipient2);
  utl_smtp.rcpt (conn, recipient3);
  utl_smtp.data(conn, messag||crlf||crlf||nvl(messaggio,'-'));
  utl_smtp.quit(conn);
EXCEPTION
when utl_smtp.transient_error or utl_smtp.permanent_error  then
  utl_smtp.quit(conn);
  raise_application_error (-20000, 'mail error: '||sqlerrm);
END SEND_ALERT;
END PKG_ALERT;I am having problems with the mail server and I can not test it, is correct?
How can I using also the sender in a table?
Have you any idea?

Similar Messages

  • Oracle Zip and Send Mail

    Hi,
    I was just wondering if there is a pl/sql code that would do the following:
    1. Zip a file (originally generated from DB query written to Unix OS using UTL_FILE package).
    2. Place a password on the file.
    3. Send the file as an attachment in mail.
    Thanks in advance.

    For compression, you can use UTL_COMPRESS package.
    [oracle@db11ghost ~]$ cat compress_data.txt
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa
    bbbbbbbbbbbbbbbbbbbbbbbbbbbb
    cccccccccccccccccccccccccccc
    [oracle@db11ghost ~]$
    Below is example how to load file to table as compressed blob. Later you can save this blob to file (pls, search google there are many examples how to do it) and send mail as attach.
    SQL> create directory MYDIR as '/home/oracle/';
    Directory created.
    declare
      ablob blob;
      abfile bfile := bfilename('MYDIR', 'compress_data.txt');
      amount integer;
      asize integer;
      a_compressed_blob blob;
      q integer := 1; ---- The level of compression from 1-9
      cursor blob_cur is select * from myt1;
    begin
      insert into myt1 values (1, empty_blob());
      select y into ablob from myt1 where x = 1;
      dbms_lob.fileopen(abfile);
      asize := dbms_lob.getlength(abfile);
      dbms_output.put_line('Size of input file: ' || asize);
      -- load the file (txt file) into the blob column and look at the size
      dbms_lob.loadfromfile(ablob, abfile, asize);
      asize := dbms_lob.getlength(ablob);
      dbms_output.put_line('Size of blob after loading fromfile: ' || asize);
      -- compress the blob
      a_compressed_blob := utl_compress.lz_compress(ablob, q);
      -- insert the compressed blob into the table in another row
      insert into myt1 values (2, a_compressed_blob);
      -- compare the sizes of the blob contents that are in the table now
      dbms_output.put_line('Sizes are -->');
      for c1_rec in blob_cur
        loop
        asize := dbms_lob.getlength(c1_rec.y);
        dbms_output.put_line(asize);
      end loop;
    end;
    Size of input file: 87
    Size of blob after loading fromfile: 87
    Sizes are -->
    87
    32
    PL/SQL procedure successfully completed.For sending you can use UTL_MAIL (http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_mail.htm#i1001258)

  • Config Oracle Alert to send mail

    Hi everyone !
    I want to setup Event Alert to send mail use Unix sendmail in our project.
    My Apps is 9.5.10.2 CU2, i have never applied to Rollup4.( Rollup 4 send mail with WF)
    If i want system to sent a message from [email protected] to [email protected], i configed sendmail package successfull. What do i do next step ?
    Further, In Page 9.3 of Oracle Alert User's Guide, at Setp 2, How to create Mail System Administrator?
    Regard !
    Edited by: whoami! on Nov 20, 2009 6:19 PM

    I config Alert on other table and see issue following: in only Alert but when 8 row updated then create 8 requests, and auto perform 8 actions to sends 8 same mail.But i want only system to send 1 mail .
    Can you help me !
    Detail:
    When I create 1 PO,i want system to send 1 mail to superior to approval, i use SQL:
    =====================
    select
    created_by,
    last_updated_by,
    rowid,
    authorization_status,
    LAST_UPDATE_LOGIN,
    approved_flag,
    wf_item_type,
    wf_item_key,
    xml_flag,
    submit_date
    into
    &cby,
    &last_updated_by,
    &rowid,
    &auth_status,
    &LAST_UPDATE_LOGIN,
    &approved_flag,
    &wf_item_type,
    &wf_item_key,
    &xml_flag,
    &submit_date
    from po_headers_all
    where
    (last_updated_by=1147
    and created_by=1147
    and upper(authorization_status)='IN PROCESS'
    and LAST_UPDATE_LOGIN = -1
    and approved_flag is not null
    and wf_item_type is not null
    and wf_item_key is not null
    and xml_flag is not null
    and submit_date is not null
    and rowid=:rowid)
    ===================
    Thanks for advance !

  • SMTP service on in oracle database to send mail directly from oracle databa

    I want to send mail from my oracle database.
    I have followed the steps below:
    1> Run utlmail.sql & prvtmail.plb
    2>set smtp_out_server parameter
    3>To send mail, execute utl_mail.send(sender=>'',recipients=>'',message=>'ABC');
    My concept is to provide smtp/mail server ip & port in smtp_out_server parameter's value.
    But One person said that oracle database server can make itself as a smtp server.So that we can assign database server ip & port in smtp_out_server parameter's value.We have to just on the smtp service in oracle database itself.There is no requirement of smtp/mail server ip & port.Is it true?How can we do that?
    In google to Add an SMTP Service,the document said in the 1st line that on the Services tab on the left, select a Process tree node (for example, the default Oracle Enterprise Gateway).
    I am sorry to say that I did not find that.Anyone can help me please?
    Please reply anyone.
    Edited by: 979620 on Feb 6, 2013 3:20 AM

    Hi Richa:
    As you mentioned, it has been working for the last six moneth. Was there any changes before it stopped working?
    Also you mentioned you were able to recieve mails from Domain user. Could you please get the Internet Headers: Open a mail from domain sender -> file ->property -> Internet Headers, send it with a mail to me:[email protected]
    Meanwhile, as this is a Office 365 related issue, it is better to post your quesetion in
    this forum. Thank you.

  • Sending MAIL on particular date in APEX 4.1

    Hello all,
    I want send mail automatically on the basis of a date column in my table. whenever that date is the current date of the system a mail should be sent to user?
    Please help me with this.

    Hello Pankaj,
    My approach will be as follows:
    <ul><li>
    Create a procedure to notify all the users whose say account expiry date matches system date i.e. sysdate
    procedure send_notification
    as
    begin
    for rec in (select EMP_ID, EMP_MAIL from EMP where ACCT_EXP_DT = SYSDATE)
    loop
         //call procedure to send mail to notify the expiry date
    end loop;
    end;</li><li>
    Now, schedule the above procedure to run every day at say 06:00 PM with the help of DBMS_SCHEDULER
    begin
    -- create a schedule
    -- daily from Monday to Sunday at 18:00 (06:00 p.m.) 
    dbms_scheduler.create_schedule (
    schedule_name    => 'INTERVAL_DAILY_1800', 
    start_date       => trunc(sysdate)+18/24, 
    repeat_interval  => 'FREQ=DAILY; BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN; BYHOUR=18;', 
    comments         => 'Runtime: Every day (Mon-Sun) at 18:00 o''clock');
    -- Call the procedure to send mail 
    dbms_scheduler.create_program (
    program_name    => 'PROG_NOTIFY_ACCNT_EXP', 
    program_type    => 'STORED_PROCEDURE', 
    program_action  => 'SEND_NOTIFICATION', 
    enabled         => true, 
    comments        => 'Procedure to notify account expiry' );
    -- Connect both dbms_scheduler parts by creating the final job 
    dbms_scheduler.create_job (
    job_name       => 'JOB_NOTIFY_ACCNT_EXP', 
    program_name   => 'PROG_NOTIFY_ACCNT_EXP', 
    schedule_name  => 'INTERVAL_DAILY_1800', 
    enabled        => true, 
    auto_drop      => false, 
    comments       => 'Job to notify account expiry');
    end;</li></ul>
    If you are planning to use [url http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_mail.htm#CIHDIEJI]APEX_MAIL package to send mail and if you are using packaged procedure to send mail then take following in consideration:
    {message:id=10145867}
    Hope it helps!
    Regards,
    Kiran

  • Q: Send Mail for TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5

    I have an oracle database 8.1.7 , NLS_LANG is TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5 and Using Pl/sql Package to send mail, I can't send Chinese from mail package, This is my problem.
    null

    The original SMTP protocol requires that the email to be in pure ASCII. To send email in Chinese, you may either use 8bit-MIME extension (if your SMTP server supports it, which is supported quite commonly these days) and send the email as-is, or encode your email that contain non-ASCII in one of the few MIME encoding scheme (e.g. Base-64, Quote-Printable) so that the encoded form is in pure ASCII.
    The following is an example that send email using 8bit-MIME extenstion:
    Rem
    Rem mb_smtp.sql - Demo program to show how to send non-ASCII (including
    Rem multi-byte) e-mails over the SMTP protocol using the UTL_SMTP package.
    Rem It requires the remote SMTP server to support 8bit-MIME SMTP extension
    Rem (which many SMTP servers support nowadays).
    Rem
    DECLARE
    -- A signature that will appear in the mail's MIME header. Useful for
    -- versioning.
    AGENT_SIGNATURE CONSTANT VARCHAR2(100) := 'Oracle 8i - UTL_SMTP';
    -- SMTP server
    SMTP_SERVER CONSTANT VARCHAR2(256) := 'smtp.some-domain.com';
    TYPE vc2_table IS TABLE OF VARCHAR2(256) INDEX BY binary_integer;
    conn utl_smtp.connection;
    sender VARCHAR2(256);
    recipients vc2_table;
    -- Helper procedure to set a MIME header
    PROCEDURE mime_header(conn IN OUT NOCOPY utl_smtp.connection,
    name IN VARCHAR2,
    value IN VARCHAR2) AS
    BEGIN
    utl_smtp.write_data(conn, name &#0124; &#0124; ': ' &#0124; &#0124; value &#0124; &#0124; utl_tcp.CRLF);
    END;
    PROCEDURE mime_header_continue(conn IN OUT NOCOPY utl_smtp.connection,
    value IN VARCHAR2) AS
    BEGIN
    utl_smtp.write_data(conn, ' ' &#0124; &#0124; value &#0124; &#0124; utl_tcp.CRLF);
    END;
    -- Helper function to generate full email signature. Format of
    -- is '"First-name Last-name" <email-address>'
    FUNCTION get_full_signature(userid IN VARCHAR2) RETURN VARCHAR2 AS
    BEGIN
    RETURN '"' &#0124; &#0124; userid -- can use LDAP to find full name of recipient here
    &#0124; &#0124; '" <' &#0124; &#0124; userid &#0124; &#0124; '>';
    END;
    -- Begin a mail connection:
    -- conn - SMTP connection
    -- sender - sender's email addr (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    -- recipients - recipients's user IDs
    -- subject - email subject
    -- mime_type - MIME type ('text/plain' - plan text, 'text/html' - HTML)
    -- RETURN:
    -- FALSE when shouldn't continue because:
    -- 1. zero recipients
    -- 2. mail server is down
    -- TRUE when the caller should proceed.
    FUNCTION begin_mail(conn OUT NOCOPY utl_smtp.connection,
    sender IN VARCHAR2,
    recipients IN vc2_table,
    subject IN VARCHAR2,
    mime_type IN VARCHAR2) RETURN BOOLEAN IS
    replies utl_smtp.replies;
    eight_bit_mime_support BOOLEAN;
    BEGIN
    IF (recipients.count <=0) THEN
    RETURN FALSE;
    END IF;
    BEGIN
    conn := utl_smtp.open_connection(SMTP_SERVER);
    EXCEPTION
    WHEN utl_smtp.transient_error THEN
    RETURN FALSE; -- SMTP server not available
    END;
    -- open SMTP connection
    replies := utl_smtp.ehlo(conn, 'some-domain.com');
    eight_bit_mime_support := FALSE;
    FOR i IN 1..replies.count LOOP
    IF ((replies(i).code < 200) OR (replies(i).code > 299)) THEN
    RAISE program_error; -- SMTP server doesn't support EHLO command
    END IF;
    IF replies(i).text = '8BITMIME' THEN
    eight_bit_mime_support := TRUE;
    END IF;
    END LOOP;
    IF (NOT eight_bit_mime_support) THEN
    RAISE program_error; -- no 8bit-MIME support
    END IF;
    -- specify sender's address (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    utl_smtp.mail(conn, sender);
    -- specify recipient(s) of the email.
    FOR i IN 1..recipients.count LOOP
    utl_smtp.rcpt(conn, recipients(i));
    END LOOP;
    -- start body of email
    utl_smtp.open_data(conn);
    -- Set "From" MIME header
    mime_header(conn, 'From', get_full_signature(sender));
    -- Set "To" MIME header. Overflow 2nd and following recipients
    -- to separate lines to avoid hitting SMTP line-size limit.
    IF (recipients.count = 1) THEN
    mime_header(conn, 'To', get_full_signature(recipients(1)));
    ELSE
    mime_header(conn, 'To', get_full_signature(recipients(1)) &#0124; &#0124; ',');
    FOR i IN 2..recipients.count LOOP
    mime_header_continue(conn, get_full_signature(recipients(i)));
    IF (i < recipients.count) THEN
    mime_header_continue(conn, get_full_signature(recipients(i)) &#0124; &#0124;
    ELSE
    mime_header_continue(conn, get_full_signature(recipients(i)));
    END IF;
    END LOOP;
    END IF;
    mime_header(conn, 'Subject', subject); -- Other SMTP headers
    -- Content-type MIME headers
    mime_header(conn, 'Content-Type', mime_type);
    mime_header(conn, 'X-Mailer', AGENT_SIGNATURE);
    -- Priority:
    -- 1, 2 - High
    -- 3 - Normal
    -- 4, 5 - Low
    mime_header(conn, 'X-Priority', 1);
    -- This empty line denotes end of MIME headers and beginning of message
    -- body. Don't remove.
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    RETURN TRUE;
    END;
    -- Write actual ASCII message body (plain text or HTML). Can be called
    -- repeatedly.
    PROCEDURE write_body(conn IN OUT NOCOPY utl_smtp.connection,
    data IN VARCHAR2) AS
    BEGIN
    utl_smtp.write_data(conn, data);
    END;
    -- Write actual non-ASCII (including multi-byte) message body.
    -- Can be called repeatedly.
    PROCEDURE write_mb_body(conn IN OUT NOCOPY utl_smtp.connection,
    data IN VARCHAR2) AS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(data));
    END;
    -- End the email.
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) AS
    BEGIN
    utl_smtp.close_data(conn);
    utl_smtp.quit(conn);
    END;
    BEGIN
    -- Sender
    sender := '[email protected]';
    -- List of mail recipients (userids).
    recipients(1) := '[email protected]';
    IF (begin_mail(conn, sender, recipients, 'Mail subject',
    'text/plain; charset=big5')) THEN
    -- Send plain text mail content.
    write_body(conn, 'line 1.' &#0124; &#0124; utl_tcp.CRLF);
    write_body(conn, 'line 2.' &#0124; &#0124; utl_tcp.CRLF);
    write_body(conn, 'line 3.' &#0124; &#0124; utl_tcp.CRLF);
    write_mb_body(conn, 'line 1 <some multi-byte text> 1i>G$M.' &#0124; &#0124;
    utl_tcp.CRLF);
    -- End mail.
    end_mail(conn);
    END IF;
    EXCEPTION
    -- In begin_mail, utl_smtp.transient_error exception is trapped if
    -- the SMTP server is not available. If other error occurs (e.g. the
    -- the mail is rejected because bad sender address), trap the
    -- exception, do something and close the connection.
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    utl_smtp.quit(conn);
    END;
    null

  • Send mail in a trigger

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

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

  • Sending mail in Solaris OS

    I have used javax.mail package for sending mail options in a web application on Windows.Can I use the same in Solaris ??
    Thanks in advance!!

    Yes.

  • Urgent: How to overcome the send mail limitation

    I am trying to use htmldb_mail PL/SQL package to send mail to 400 people, but get following message:
    "."WWV_FLOW_MAIL_QUEUE"."MAIL_TO" (actual: 3551, maximum: 2000)
    How do I overcome the limitation?
    Any suggestions will be greatly appreaciated.

    Things that spring to mind -
    1) Setup a mailing list on a mailserver (if you're using one like Exchange, Sendmail, Postfix etc) and have your application email the mailing list. That way your app sends out 1 email, and the mail server takes care of expanding the address list to the 400 people (this is probably the most 'efficient' way to do it).
    2) Do your mailing in part (e.g. 100 people at a time), so you send out 4 emails with each one addressed to a batch of 100 people
    3) Use the CC list (I don't believe the CC list has the same limit, but I haven't checked).
    4) Send out the emails individually, e.g. one email per recipient...this is an absolutely horrendous way to do it however, the load on your mailserver will be hugely increased and your mail administrator will probably shout at you, however it's an option (I wouldn't do it this way, but it is an option). I repeat....I'm not advocating you do it this way.....

  • Sending Mail from JSP-Servlet

    hi all,
    Can any one help me, how can i send the mail from JSP-Servlet.
    in Spring, we have a the following package to send mail,
    import org.springframework.mail.MailSender;
    import org.springframework.mail.SimpleMailMessage;
    import org.springframework.mail.javamail.JavaMailSenderImpl;
    Suggest me to solve the problem.
    Thanx in advance.
    Bala

    Hi balu,
    i already go thru that API. My problem is if i add any additional jar file for sending the mail from JSP or Servlets only. not in high technology.
    i mention spring as an example.
    so, kindly suggets me on that.
    Bala

  • Sending mails with attachments using oracle 8i

    Hi,
    Could anybody please send a sample code for sending mails
    with attachments using oracle 8i.
    Thanks in advance

    For oracle8i there is an example package from OTN:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    You have to re-write the package a bit to work it with BLOBs instead of RAW attachments, but that should be no problem
    Hop this helps,
    Michiel

  • Sending an Email from within an Oracle Package

    Hi,
    I am trying to send an email from within a Oracle package Body. The code i have to do this is as follows: -
    PROCEDURE send_mail(sender_in IN VARCHAR2,
    recipient_in IN VARCHAR2,
    date_from_in IN VARCHAR2,
    date_to_in IN VARCHAR2) IS
    -- Procedure to send e-mail
    mailhost VARCHAR2(30) := '192.168.2.6';
    crlf VARCHAR2(2) := CHR(13)||CHR(10);
    --message VARCHAR2(32767);
    message LONG;
    mail_conn utl_smtp.connection;
    reply VARCHAR2(512);
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    message := 'Date: '||TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS')||crlf||
    'From: <'||sender_in||'>'||crlf||
    'Subject: ''Holiday Request'||crlf||
    'To: '||recipient_in||crlf||
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender_in);
    utl_smtp.rcpt(mail_conn, recipient_in);
    utl_smtp.data(mail_conn, message);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN others THEN
    RAISE;
    END send_mail;
    end holidays;
    I have one question though. I am getting a ORA-29278 SMTP Transien Error: 421 Service Nota Available Error. I think this may be due to the 'Mailhost' value I have given in the above code. I have been informed that this should be the ip address of the mail server used or the ip address of the machine if it is being run locally. What would i need to put in here if i wish for an email to be sent from one hotmail address to another for example?
    Any help would be much appreciated!
    Thanks!
    Darren

    hi
    The funnier part is that
    u can actually type in the sender's email id irrespective of the mail host used
    Like @hotmail.com,@yahoo.com etc.
    The receiver will get the mails from the email id that u wrote .
    The problem u r facing is becoz of the incorrect mail host server ip address
    Try to get in touch with the network admin for the mail server ip address
    other way is
    get the name it would be like
    smtp.domain name .
    hope that helps

  • ORA-29279: SMTP permanent error: To Send Mail from Oracle 10g (10.2.0.1)

    I have installed Oracle 10g (10.2.0.1) on Windows XP (SP2) machine at my home PC.There is a broadband connection on my home PC.I have installed UTL_MAIL package and then set SMTP_OUT_PARAMETER by the following SQL Statement.
    My machine IP address is 192.168.0.3
    SQl> alter system set smtp_out_server = 'smtp.bsnl.in:25' scope = 25;
    Then we run the following script.
    BEGIN
    UTL_MAIL.SEND(
    SENDER => '[email protected]',
    RECIPIENTS => '[email protected]',
    SUBJECT => 'Testing UTL_MAIL',
    MESSAGE => 'The receipt of this email means'||
    'that it works for UTL_MAIL'
    END;
    Then following error message comes.
    BEGIN
    ERROR at line 1:
    ORA-29279: SMTP permanent error: 553 Authentication is required to send mail as
    <[email protected]>
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 222
    ORA-06512: at "SYS.UTL_MAIL", line 407
    ORA-06512: at "SYS.UTL_MAIL", line 594
    ORA-06512: at line 2
    Can anybody suggest the solution of the above problem.

    Hi,
    is your smtp server configured to use anonymous connection?
    Attackwave
    Reply Code       Description
    211      System status, or system help reply
    214      Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user]
    220      <domain> Service ready
    221      <domain> Service closing transmission channel
    250      Requested mail action okay, completed
    251      User not local; will forward to <forward-path>
    252      OK, pending messages for node <node> started. Cannot VRFY user (for example, info is not local), but will take message for this user and attempt delivery.
    253      OK, <messages> pending messages for node <node> started
    354      Start mail input; end with <CRLF>.<CRLF>
    355      Octet-offset is the transaction offset
    421      <domain> Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down.)
    450      Requested mail action not taken: mailbox unavailable [for example, mailbox busy]
    451      Requested action terminated: local error in processing
    452      Requested action not taken: insufficient system storage
    453      You have no mail.
    454      TLS not available due to temporary reason. Encryption required for requested authentication mechanism.
    458      Unable to queue messages for node <node>
    459      Node <node> not allowed: reason
    500      Syntax error, command unrecognized (This may include errors such as command line too long.)
    501      Syntax error in parameters or arguments
    502      Command not implemented
    503      Bad sequence of commands
    504      Command parameter not implemented
    521      <Machine> does not accept mail.
    530      Must issue a STARTTLS command first. Encryption required for requested authentication.
    534      Authentication mechanism is too weak.
    538      Encryption required for requested authentication mechanism.
    550      Requested action not taken: mailbox unavailable [for , mailbox not found, no access]
    551      User not local; please try <forward-path>
    552      Requested mail action terminated: exceeded storage allocation
    *553      Requested action not taken: mailbox name not allowed [for example, mailbox syntax incorrect]*
    554      Transaction failed

  • Sending mail in Oracle 8i

    Hi,
    I am trying to send an email in Oracle 8i Personnel edition, but have encountered problems with the UTL_SMTP package. I have a stored procedure to send mail, but when I run this procedure, I get the following error messages:
    ORA-20001: 421 Service not available
    ORA-06512: at "SYSTEM.UTL_SMTP", line 83
    ORA-06512: at "SYSTEM.UTL_SMTP", line 121
    ORA-06512: at "SYSTEM.DEMO_MAIL", line 257
    ORA-06512: at "SYSTEM.DEMO_MAIL", line 118
    ORA-06512: at "SYSTEM.DEMO_MAIL", line 104
    ORA-06512: at line 2.
    Can anyone help??

    If you can't access the utl_smtp package (you can also look from Oracle Developper by opening the Database node followed by the SYS node which will list the database packages), here is a quick example using OLE2:
    DECLARE
    objOutlook OLE2.OBJ_TYPE;
    objArg OLE2.LIST_TYPE;
    objMail OLE2.OBJ_TYPE;
    BEGIN
    objOutlook := OLE2.CREATE_OBJ('Outlook.Application');
    objarg := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(objarg,0);
    objMail := OLE2.INVOKE_OBJ(objOutlook,'CreateItem',objarg);
    OLE2.DESTROY_ARGLIST(objarg);
    OLE2.SET_PROPERTY(objmail,'To','<emailaddress>');
    OLE2.SET_PROPERTY(objmail,'Subject','Test email from Oracle Forms');
    OLE2.SET_PROPERTY(objmail,'Body','This is a test sending mail from Oracle forms');
    OLE2.INVOKE(objmail,'Display');  to display before sending
    OLE2.INVOKE(objmail,'Send');
    OLE2.RELEASE_OBJ(objmail);
    OLE2.RELEASE_OBJ(objOutlook);
    END;

  • How to setup and send mails using utl_mail on Oracle E-Biz R12

    Dear All
    There is a new requirement from client to setup and send mails using utl_mail utility on Oracle EBS R12.1.1
    What is utl_mail utility ? what is the difference between Workflow Notification Mailer and this utility/tool?
    What are etiquette's to pursue mail functionality in apps / db?
    - Chetan

    What is utl_mail utility
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_mail.htm
    How to Use the UTL_MAIL Package [ID 269375.1]
    FAQ and Known Issues While Using UTL_SMTP and UTL_MAIL [ID 730746.1]
    Master Note For PL/SQL UTL_SMTP and UTL_MAIL Packages [ID 1137673.1]
    Workflow Notification Mailer:
    you can send email using workflow notification email procedures,These ar built into the system and only need some minor configuration. check Workflow Administrator's Guide, Chapter 2, Section: Setting Up Notification Mailers for more detail.

Maybe you are looking for

  • Bex report doesn't display full text information......

    Hi Experts, My bex report is not displaying full text information. I have set that particular infoobject length as 40 and also have selected long text and Long Description in Bex Tab of the InfoObject. In my DSO the data is available in complete leng

  • Blue Ray Navigation Oddity

    I finished a DVD and verything works as anticipated. Then I composed a Blue Ray Disc with basically the same content just better (1080P) quality. The BD runs fine except for one odd thing: Apparently each menu item has an ID number. Then one can conf

  • Problems with certain text appearing once exported as HTML on my third party hosting site

    Hello, I am experiencing problems with how certain text is appearing on my website www.pplmedia.com/speakers. Most of the text is appearing how I want it to once I have exported it out of Muse, but for a reason I can not rectify, certain text is comi

  • Please help getting invalid number error.

    Hi Experts, My requirement is If DT_ID value of xmlmsg existed in the DT_ID of PART_ID_COLLES table then that record should be processd else should be skipped. And xmlmsg of PART_ID should start with "A" and followed only by the number then that reco

  • Upload to FTP

    Hello, I have been having difficulty and I need assistance. I created a new design for a site that is already operational. I uploaded the site created in Muse to FTP. Everything seems to be there, however when you pull the website up online it shows