Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    chennai, India
    Posts
    2

    Thumbs up Unanswered: Mailing from Oracle Stored Proc

    Hi all,

    i need to send email from oracle stored procedure, How to do it, can someone help me

  2. #2
    Join Date
    Aug 2003
    Posts
    41
    You can use UTL_SMTP package to do this. There should be an example in some documentation. Or give a google search.

    -Sunil.

  3. #3
    Join Date
    Jul 2003
    Location
    Kansas, USA
    Posts
    12
    Here's a working example.. This assumes that there is a sendmail server listening on the same server that the database is running on. Otherwise, change the MailHost variable to point to a sendmail host.

    DECLARE

    vMailHost varchar2(100);
    vSender varchar2(100);
    vRecipient varchar2(100);
    vSubject varchar2(100);
    vBody varchar2(100);
    vPort number;
    vMailConn utl_smtp.connection;

    BEGIN

    vMailHost := 'localhost';
    vSender := 'you@yourdomain.com';
    vRecipient := 'them@theirdomain.com';
    vSubject := 'This is the subject';
    vBody := 'This is the body';
    vPort := 25;

    vMailConn := utl_smtp.open_connection(vMailHost, vPort);

    utl_smtp.helo(vMailConn, vMailHost);

    utl_smtp.mail(vMailConn, vSender);

    utl_smtp.rcpt(vMailConn, vRecipient);

    utl_smtp.data(vMailConn,
    'Subject : '||vSubject || CHR(10) || CHR(13) || vBody);

    utl_smtp.quit(vMailConn);

    END;
    /
    Adam vonNieda
    http://www.oracletool.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •