Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    2

    Unanswered: Invalid reply code for Utl_stmp

    Hi there,

    I am trying to use utl_smtp to send out email to our customers. How can we tell is the email successful delivered ? Does reply code indicate the successful of delivery ? Below is a testing procedure I had created. I got the same result on the reply code (250) whenever I send a valid email address or a dummy email address. Anyone have any idea ?


    CREATE OR REPLACE PROCEDURE SimpleTextMessage1 IS
    mailHOST VARCHAR2(64) := 'mailhost.mydomain.com';
    mailFROM VARCHAR2(64);
    mailTO VARCHAR2(64);
    mailCONN utl_smtp.connection;
    mailDATE VARCHAR2(20);
    vreply utl_smtp.reply;

    BEGIN
    mailFROM := 'test@mydomain.com';
    mailTO := 'dummytestwo@yahoo.com';
    SELECT TO_CHAR(SYSDATE,'MM/DD/YYYY HH24:MIS') INTO mailDATE FROM dual;


    vreply := utl_smtp.open_connection(mailHOST, 25, mailCONN);

    dbms_output.put_line('mail');
    dbms_output.put_line('----');
    vreply := utl_smtp.mail(mailCONN, mailFROM);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );

    vreply := utl_smtp.rcpt(mailCONN, mailTO);
    dbms_output.put_line('mailto');
    dbms_output.put_line('----');
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );


    vreply := utl_smtp.open_data(mailCONN);
    dbms_output.put_line('open_data');
    dbms_output.put_line('----');
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );

    utl_smtp.write_data(mailCONN, 'Subject: '|| 'A subject' || chr(13));


    utl_smtp.write_data(mailCONN, 'From: '||mailFROM || chr(13));
    utl_smtp.write_data(mailCONN, 'Date: '||mailDATE || chr(13));
    utl_smtp.write_data(mailCONN, 'To: '||mailTO || chr(13));
    utl_smtp.write_data(mailCONN, 'CC: '||mailFROM || chr(13));
    utl_smtp.write_data(mailCONN, 'BCC: '||mailFROM || chr(13));
    utl_smtp.write_data(mailCONN, chr(13));
    utl_smtp.write_data(mailCONN, 'Hello Friend.' || chr(13));
    utl_smtp.write_data(mailCONN, 'Drop me an e-mail.' || chr(13));



    vreply := utl_smtp.close_data(mailCONN);
    dbms_output.put_line('close_data');
    dbms_output.put_line('----');
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );


    vreply := utl_smtp.quit(mailCONN);

    dbms_output.put_line('done');
    dbms_output.put_line('----');
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );


    END;
    /


    Thanks,
    Rebecca

  2. #2
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    Rebecca,

    It's been my experience that SMTP servers won't usually return information back to the Oracle packages as to whether or not the email was delivered...simply, that it accepted the email message from the procedure and it will now "take things from here".

    Really the only messages I've ever gotten back from my SMTP servers is whether or not the email was received by the server... from that point the UTL_SMTP is happy that it did it's part and returns "PL/SQL Procedure successfully completed."

    In actuality, the SMTP server is probably "sending" a response back, but the procedure has already done it's job and is simply not "listening" for that kind of response.

    Best I can tell with my limited knowledge of email services...
    JoeB
    save disk space, use smaller fonts

  3. #3
    Join Date
    Dec 2003
    Location
    Oklahoma, USA
    Posts
    354
    I suppose one way to check will be to find all "bounced" messages back at your SMTP server (mailhost.mydomain.com). If you supply the Oracle package with a somewhat obsequious name for the "mailFROM" line (which, by the way, this doesn't have to be an "actual" email address), you can always use an email rule to find and route them to the person maintaining customer email addresses... just an idea.
    JoeB
    save disk space, use smaller fonts

  4. #4
    Join Date
    Jan 2005
    Posts
    2
    Thanks Joe. I will look into that.

Posting Permissions

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