Forum Stats

  • 3,782,050 Users
  • 2,254,585 Discussions
  • 7,879,901 Comments

Discussions

ORA-29278: SMTP transient error: 421 Service not available

vpolasa
vpolasa Member Posts: 393 Blue Ribbon
edited Oct 13, 2008 10:55PM in SQL & PL/SQL
Hi all,

I'm using Oracle 10g working on Windows XP Home.
I'm trying to send a basic mail from my stored procedure.
When I tried to run the code, I get ORA-29278: SMTP transient error: 421 Service not available.

Below is the code I'm trying.

CREATE OR REPLACE PROCEDURE SEND_MAIL (
msg_to varchar2,
msg_subject varchar2,
msg_text varchar2 )
IS
c utl_smtp.connection;
rc integer;
msg_from varchar2(50) := 'Oracle9.2';
mailhost VARCHAR2(30) := '127.0.0.1'; -- local database host
BEGIN

c := utl_smtp.open_connection(mailhost, 25); -- SMTP on port 25
dbms_output.put_line('ok');
utl_smtp.helo(c, mailhost);
utl_smtp.mail(c, msg_from);
utl_smtp.rcpt(c, msg_to);

utl_smtp.data(c,'From: Oracle Database' || utl_tcp.crlf ||
'To: ' || msg_to || utl_tcp.crlf ||
'Subject: ' || msg_subject ||
utl_tcp.crlf || msg_text);
utl_smtp.quit(c);


EXCEPTION

WHEN UTL_SMTP.INVALID_OPERATION THEN
dbms_output.put_line(' Invalid Operation in Mail attempt using UTL_SMTP.');

WHEN UTL_SMTP.TRANSIENT_ERROR THEN
dbms_output.put_line(' Temporary e-mail issue - try again');
dbms_output.put_line (sqlerrm);

WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Permanent Error Encountered.');
END;
/

Below are the possibilites I tried..

I tried to ping localhost.. This is the output I get

C:\Documents and Settings\Me>ping localhost

Pinging polasa [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

In one of the thread, a user suggested to do the following

Go to Control Panel->Add or Remove Programs->Click on
Add/Remove Wndows Components
Check IIS check box.
Select Internet Information Service (IIS) option and click on Details button
Check whether SMTP Service is checked or not.
If not selected then select SMTP check box.

This process should be done on server.
It will help out from ORA-29278: SMTP transient error: 421 Service not available
problem.

There is no IIS in my Windows Components..

Any suggestions? Thanks in advance
Tagged:

Best Answer

  • JustinCave
    JustinCave Member Posts: 30,293 Gold Crown
    Accepted Answer
    It sounds like you don't have an SMTP server running on your local machine.

    Even if you install IIS (or some other SMTP server), that is probably not enough to send email outside of your machine because your machine is unlikely to be trusted by the downstream mail servers. If you are running this in a company, you'll need to talk to your company's mail admin to determine where the corporate SMTP server is running. If you running this at home, you'll need to find out from your ISP what SMTP servers are available to you.

    Justin

Answers

  • JustinCave
    JustinCave Member Posts: 30,293 Gold Crown
    Accepted Answer
    It sounds like you don't have an SMTP server running on your local machine.

    Even if you install IIS (or some other SMTP server), that is probably not enough to send email outside of your machine because your machine is unlikely to be trusted by the downstream mail servers. If you are running this in a company, you'll need to talk to your company's mail admin to determine where the corporate SMTP server is running. If you running this at home, you'll need to find out from your ISP what SMTP servers are available to you.

    Justin
  • vpolasa
    vpolasa Member Posts: 393 Blue Ribbon
    Thanks Justin,

    I'm trying to learn UTL_SMTP package. Is there a way I can work on the code to send mails. (probably with any SMTP default value)
    I'm working on my personal computer at my home.

    Vikram
  • JustinCave
    JustinCave Member Posts: 30,293 Gold Crown
    If you want to send mail, you'll need an SMTP server. Your ISP will generally have an SMTP server that you can use and that's the easiest option.

    Barring that, it would be possible to create an entire self-contained email infrastructure on your own machine where you install an SMTP server, a POP server, a POP client, configure a new email address and domain that you're sending to, etc. but that's quite a bit of infrastructure to have running just to play with the UTL_SMTP package.

    Justin
This discussion has been closed.