2 Replies Latest reply: Feb 12, 2005 12:39 PM by dccase RSS

    SMTP Password required

    437968
      My SMTP Server requires us to user a username/password. I noticed in the HTML DB Admin settings their is only options for server and port. How do I register a username/password?
        • 1. Re: SMTP Password required
          joelkallman-Oracle
          Martin,

          Unfortunately, there is no way to accomplish this in HTML DB. We can consider this for a future release in HTML DB, but we haven't seen overwhelming demand for it.

          About all I can suggest is your own e-mail implementation in PL/SQL (using UTL_SMTP or the new-in-10g UTL_MAIL, although it looks like even UTL_MAIL does not let you provide credentials).

          It's possible but I'm not sure if putting an authenticated relay server between HTML DB and the outbound SMTP server would circumvent this.

          Joel
          • 2. Re: SMTP Password required
            dccase
            You can use UTL_SMTP to send mail through a server that requires authentication by sending the authentication commands after connecting. I use a procedure like the one below. I submit it using DBMS_JOB.

            CREATE OR REPLACE PROCEDURE "SEND_MAIL" (
            p_sender IN VARCHAR2,
            p_recipient IN VARCHAR2,
            p_message IN VARCHAR2
            )
            AS
            l_mailhost VARCHAR2 (255) := 'your.outgoing.mailserver.address';
            l_mail_conn UTL_SMTP.connection;
            BEGIN
            l_mail_conn := UTL_SMTP.open_connection (l_mailhost, 25);
            utl_smtp.command( l_mail_conn, 'AUTH LOGIN');
            utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( 'Your Mail UserName' ))) );
            utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( 'Your Mail Password' ))) );
            UTL_SMTP.helo (l_mail_conn, l_mailhost);
            UTL_SMTP.mail (l_mail_conn, p_sender);
            UTL_SMTP.rcpt (l_mail_conn, p_recipient);
            UTL_SMTP.open_data (l_mail_conn);
            utl_smtp.write_data(l_mail_conn, 'Subject: Your Subject Line Here');
            UTL_SMTP.write_data (l_mail_conn, p_message);
            UTL_SMTP.close_data (l_mail_conn);
            UTL_SMTP.quit (l_mail_conn);
            END;