Link to home
Start Free TrialLog in
Avatar of hiswapna
hiswapna

asked on

Sending mail in oracle to multiple receipients

I am using 8.1.6 oracle database and I would like to send a mail to mutiple receipients with attachement. How do i acheive this. Where can i get the sample code for this
Avatar of rockiroads
rockiroads
Flag of United States of America image

I dont have examples handy but what you could make use of is UTL_STMP

Are you going to send via PL/SQL procedures I assume

here are some example sites that demonstrate use of it
http://www.oracleutilities.com/Packages/utl_smtp.html
http://www.psoug.org/reference/utl_smtp.html
http://www.quest-pipelines.com/newsletter-v2/smtp.htm
urm, spelling mistake. thats UTL_SMTP

For multiple recipients, if not catered for by UTL_SMTP, I guess you can delimit names with semi colons when specifying who to send to.

An example dug up from searchtarget.oracle.com

CREATE OR REPLACE
PROCEDURE
          send_mail (sender    IN VARCHAR2,
                     recipient IN VARCHAR2,
                     message   IN VARCHAR2,
                     nStatus   OUT NUMBER)
IS
    mailhost    VARCHAR2(30) := 'email.hai.iec.co.il'; -- host mail addr
    mail_conn  utl_smtp.connection;
BEGIN
    nStatus := 0;
    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.data(mail_conn, message);
    utl_smtp.quit(mail_conn);
EXCEPTION
    WHEN OTHERS THEN
        nStatus := SQLCODE;
END send_mail;
/


Regarding attachments. Ive not done it but have a look at this  http://home.clara.net/dwotton/dba/oracle_smtp.htm
Avatar of hiswapna
hiswapna

ASKER

Hello

thanks for the response but how do i send to multiple receipients
for multiple recipients, have a look at this

search for Unable to send HTML to multiple recipients
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial