UTL_SMTP: error 421
I have a PL/SQL block that repeatedly calls UTL_SMTP in a loop, basically e-mailing a group of addressees. The first send works fine (the message arriving successfully), but on the second and subsequent calls error 421 is raised by UTL_SMTP.HELO . My first and only guess was that messages were being sent too quickly for the mail server to process, so I inserted a 'sleep' of about five seconds between messages, but that didn't work.
I am using CLOSE_DATA and QUIT at the end of each iteration.
Many thanks,
Andrew Hunter
I have done something similar with UTL_SMTP without any problem, so there must be something funny going on.
According to the 421 means the SMTP server is down. You can check whether this is the case by inserting noop() immediately after open_connection(). If the server is available it will return 250 (use DBMS_OUTPUT to verify).
Which prompts me to ask the question "Do you have the open_connection() call in your loop?"
Otherwise you may have to post your code.
Incidentally, there is a fabulously featured mail demo package available from the OTN sample code archive which is really cool - attachments, HTML, the works. If you want a good e-mail package I recommend you use this (unless you are coding your own package for the sheer intellectual challenge).
Cheers, APC
Similar Messages
-
UTL_SMTP: can't connect to remote mail server (error: 421)
I'm trying to execute this command as SYS:
exec MYSCHEMA.send_mail_via_utl_smtp('[email protected]', '[email protected]', 'my subject', 'my message','mail.mydomain.com');
and I get this error:
Error starting at line 8 in command:
exec MYSCHEMA.send_mail_via_utl_smtp('[email protected]', '[email protected]', 'my subject', 'my message','mail.mydomain.com');
Error report:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 29
ORA-06512: at "SYS.UTL_SMTP", line 108
ORA-06512: at "SYS.UTL_SMTP", line 150
ORA-06512: at "MYSCHEMA.SEND_MAIL_VIA_UTL_SMTP", line 17
ORA-06512: at line 1
29278. 00000 - "SMTP transient error: %s"
*Cause: A SMTP transient error occurred.
*Action: Correct the error and retry the SMTP operation.
However, I can telnet successfully as root user to mail.mydomain.com. The stored procedure is:
create or replace
PROCEDURE send_mail_via_utl_smtp(
sender IN VARCHAR2,
recipient IN VARCHAR2,
subject IN VARCHAR2 DEFAULT NULL,
message IN VARCHAR2,
mailhost IN VARCHAR2 DEFAULT 'mailhost'
AS
mail_conn UTL_SMTP.connection;
crlf CONSTANT VARCHAR2(2) := CHR(13) || CHR(10);
smtp_tcpip_port CONSTANT PLS_INTEGER := 25;
BEGIN
mail_conn := UTL_SMTP.OPEN_CONNECTION(mailhost, smtp_tcpip_port);
UTL_SMTP.HELO(mail_conn, mailhost);
UTL_SMTP.MAIL(mail_conn, sender);
UTL_SMTP.RCPT(mail_conn, recipient);
UTL_SMTP.DATA(mail_conn, SUBSTR(
'Date: ' || TO_CHAR(SYSTIMESTAMP, 'Dy, dd Mon YYYY HH24:MI:SS TZHTZM') || crlf
|| 'From: ' || sender || crlf
|| 'Subject: ' || subject || crlf
|| 'To: ' || recipient || crlf
|| message,
1, 32767));
UTL_SMTP.QUIT(mail_conn);
END send_mail_via_utl_smtp;
Note that mail.mydomain.com is sitting on the application server, and not the database server (not sure if that is important here). Previously, I set things up doing the following as SYS user:
# cd $ORACLE_HOME/rdbms/admin
# sqlplus / as sysdba
SQL> @utlmail.sql;
Package created.
Synonym created.
SQL> @prvtmail.plb;
Package created.
Package body created.
Grant succeeded.
Package body created.
No errors.
SQL> ALTER SYSTEM SET smtp_out_server = "mail.mydomain.com" SCOPE=MEMORY;
System altered.
SQL> show parameter smtp_out_server
NAME TYPE VALUE
============
smtp_out_server string mail.mydomain.com
SQL> exec DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('my_acl_email.xml','for my db acl to send email', 'MYSCHEMA', TRUE, 'connect');
PL/SQL procedure successfully completed.
SQL> exec DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('my_acl_email.xml','mail.mydomain.com', 25, NULL);
PL/SQL procedure successfully completed.
It appears that the SYS user is permitted by the ACL, but is somehow blocked access to mail.mydomain.com on the application server. Are there any Linux configurations that need to occur in implementing this process? Or, am I missing something in configuring Oracle. I'm using 11.2.0.1.0. This is my first time setting this up. Does the database need to be cycled down then back up for any of these settings to take place?
Edited by: tem on Apr 20, 2012 2:45 PMThanks Justin, that helps a lot. Now, with the 'AUTH LOGIN' command, I'm getting the error:
ORA-29279: SMTP permanent error: 503 AUTH command used when not advertised
ORA-06512: at "SYS.UTL_SMTP", line 29
ORA-06512: at "SYS.UTL_SMTP", line 110
ORA-06512: at "SYS.UTL_SMTP", line 170
ORA-06512: at "JCLOCKGEN.SEND_MAIL_VIA_UTL_SMTP", line 22
ORA-06512: at line 1
29279. 00000 - "SMTP permanent error: %s"
*Cause: A SMTP permanent error occurred.
*Action: Correct the error and retry the SMTP operation.
UPDATE:
Actually, my procedure above uses this line:
UTL_SMTP.HELO(mail_conn, mailhost);
But I noticed Justin's code above uses:
UTL_SMTP.EHLO(mail_conn, mailhost);
When I change the HELO to EHLO, everything works fine. Here's the final code:
create or replace
PROCEDURE send_mail_via_utl_smtp(
sender IN VARCHAR2,
recipient IN VARCHAR2,
subject IN VARCHAR2 DEFAULT NULL,
message IN VARCHAR2,
mailhost IN VARCHAR2 DEFAULT 'mailhost',
auth_username IN VARCHAR2,
auth_password IN VARCHAR2
AS
mail_conn UTL_SMTP.connection;
crlf CONSTANT VARCHAR2(2) := CHR(13) || CHR(10);
smtp_tcpip_port CONSTANT PLS_INTEGER := 25;
BEGIN
mail_conn := UTL_SMTP.OPEN_CONNECTION(mailhost, smtp_tcpip_port);
UTL_SMTP.EHLO(mail_conn, mailhost);
--------------BEGIN AUTHENTICATION--------------
UTL_SMTP.command(mail_conn, 'AUTH LOGIN');
utl_smtp.command(mail_conn, utl_raw.cast_to_varchar2(utl_encode.base64_encode( utl_raw.cast_to_raw(auth_username))));
utl_smtp.command(mail_conn, utl_raw.cast_to_varchar2(utl_encode.base64_encode( utl_raw.cast_to_raw(auth_password))));
--------------END AUTHENTICATION--------------
UTL_SMTP.MAIL(mail_conn, sender);
UTL_SMTP.RCPT(mail_conn, recipient);
UTL_SMTP.DATA(mail_conn, SUBSTR(
'Date: ' || TO_CHAR(SYSTIMESTAMP, 'Dy, dd Mon YYYY HH24:MI:SS TZHTZM') || crlf
|| 'From: ' || sender || crlf
|| 'Subject: ' || subject || crlf
|| 'To: ' || recipient || crlf
|| message,
1, 32767));
UTL_SMTP.QUIT(mail_conn);
END send_mail_via_utl_smtp;
Edited by: tem on Apr 20, 2012 5:55 PM -
UTL_SMTP fails: SMTP transient error: 421 Service not available
Hi!
I´m trying to set up database to be able to send emails by UTL_SMTP package.
I´m working whit Oracle 9.0.2.0.7 on Windows 2003 Server EE SP1
For this, I have searched a script of the many on the network. One like this:
CREATE OR REPLACE PROCEDURE CASIUS.SEND_MAIL(SENDER IN VARCHAR2, RECIPIENT IN VARCHAR2, SUBJECT IN VARCHAR2, MESSAGE IN VARCHAR2) IS
MAILHOST CONSTANT VARCHAR2(3000) := 'server.exchange.test.com';
MESG VARCHAR2(30000);
MAIL_CONN UTL_SMTP.CONNECTION;
BEGIN
UTL_SMTP.QUIT(MAIL_CONN);
MAIL_CONN := UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25);
UTL_SMTP.EHLO(MAIL_CONN, MAILHOST);
UTL_SMTP.COMMAND( MAIL_CONN, 'AUTH', 'LOGIN ');
UTL_SMTP.COMMAND( MAIL_CONN, UTL_RAW.CAST_TO_VARCHAR2( UTL_ENCODE.BASE64_ENCODE( UTL_RAW.CAST_TO_RAW( '[email protected]' ))));
UTL_SMTP.COMMAND( MAIL_CONN, UTL_RAW.CAST_TO_VARCHAR2( UTL_ENCODE.BASE64_ENCODE( UTL_RAW.CAST_TO_RAW( 'testpassw'))));
MESG := 'Date: ' ||
TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || CHR(13) || CHR(10) ||
'From: <'|| SENDER ||'>' || CHR(13) || CHR(10) ||
'Subject: '|| SUBJECT || CHR(13) || CHR(10)||
'To: <'||RECIPIENT || '>' || CHR(13) || CHR(10) || MESSAGE;
UTL_SMTP.EHLO(MAIL_CONN, MAILHOST);
UTL_SMTP.MAIL(MAIL_CONN, SENDER);
UTL_SMTP.RCPT(MAIL_CONN, RECIPIENT);
UTL_SMTP.DATA(MAIL_CONN,MESG);
UTL_SMTP.QUIT(MAIL_CONN);
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20004,SQLERRM);
END SEND_MAIL;
I've reviewed the script many times and I find no error. But when I call it I always have this error:
ORA-20004: ORA-29278: SMTP transient error: 421 Service not available
I have done many tests. Although the most meaningful test that I have done may be the send of a message via telnet from the same server using the same parameters. It has worked!. This is the log:
220 server.exchange.test.com ESMTP Service ready
AUTH LOGIN
334 VXNad23hsdj2bWU6
bm90aWZpY2FjaW9uZMSA12smVsQHNvcG9ydGUtc21zLmVz
334 UGFzer24cmQ6
TDRdE3p6NA==
235 LOGIN authentication successful
MAIL FROM:<[email protected]>
250 MAIL FROM:<[email protected]> OK
RCPT TO: <[email protected]>
250 RCPT TO:<[email protected]> OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
From:Yomismo
TO:Mimismo
Subject: Test Send Emails
This is a send test
250 <522DCAD000D5FF89> Mail accepted
QUIT
221 server.exchange.test.com QUIT
Connection to host lost.
This test email was received for me, so I think is evidenced that the problem is in ULT_SMTP package.
And more specifically, I suspect that the exception raises on one of these lines:
UTL_SMTP.QUIT(MAIL_CONN);
MAIL_CONN := UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25);
But I don´t understand why, All the sites I have viewed uses package of similar way...
Can someone throw me some light on this issue?
Regardsmaybe you find something in https://community.oracle.com/message/3560073. And I would recommend to think about upgrading to a current Oracle version, since 9.2 has been desupported around 2007.
-
I have used Oracle 9i server (9.2.0.1 version) on Windows XP machine(with SP2).I want to send Email from PL/SQL procedure.
My Question is what sort of configuration needed to perform this activity?
I have installed IIS (Internet Information Service)
in my machine, then configure my SMTP mail server
with a valid email id and password given TCP port 465.
Later I came to know that to send Email from PL/SQL I have to install Oracle JServer Code. Follow three steps. the steps are
1. Execute the script as sys "$ORACLE_HOME\javavm\install\initjvm.sql"
2. Execute the loadjava classfile as
$ORACLE_HOME\plsql\jlib>loadjava -f -v -r -u sys/**** plsql.jar
3. Execute the script as sys "$ORACLE_HOME\rdbms\admin\initplsj.sql"
I sucessfully executed the first step, but for the second step iam not able to locate the plsql.jar file in the specified path.
So Please tell me if there is any other method to perform this task
My code is as follows.
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) := '[email protected]';
mailhost VARCHAR2(30) := 'mail.google.com';
BEGIN
c := utl_smtp.open_connection(mailhost, 465);
utl_smtp.helo(c, mailhost);
utl_smtp.mail(c, msg_from);
utl_smtp.rcpt(c, msg_to);
dbms_output.put_line(' Start Sending data');
utl_smtp.data(c,'From: Oracle Database' || utl_tcp.crlf ||
'To: ' || msg_to || utl_tcp.crlf ||
'Subject: ' || msg_subject ||
utl_tcp.crlf || msg_text);
dbms_output.put_line(' Finish Sending data');
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');
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Permanent Error Encountered.');
END;
Procedure Created.
SQL> execute prc_send_mail('[email protected]','[email protected]','Good Morning.');
BEGIN prc_send_mail('[email protected]','[email protected]','Good Morning.'); END;
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 96
ORA-06512: at "SYS.UTL_SMTP", line 374
ORA-06512: at "SCOTT.PRC_SEND_MAIL", line 19
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at line 1.
Please tell me how to solve this problem.
Thank You.1) Why did you install an SMTP server locally and then tell your code to try to use the server mail.google.com?
2) The error you're getting is from mail.google.com indicating that Google isn't running an open SMTP server there. I would be very surprised if Google were running a publicly available SMTP server anywhere since that would be an invitation for spammers.
Justin -
Mail Error: ORA-29278: SMTP transient error: 421 Service not available
I write process to send mail, it is running ok, but I have error ORA-29278: SMTP transient error: 421 Service not available.
SMTP Host Address : localhost
SMTP Host Port : 25
When I connect to database as SYS and run : exec apex_mail.push_queue result is :
Pushing email: 1225814842675154
Pushed email: 1225814842675154
PL/SQL procedure successfully completed.
Please explain me what is happened!Hi;
What is DB version?
Please see:
From Master Note For PL/SQL UTL_SMTP and UTL_MAIL Packages [ID 1137673.1] check Note 604763.1 "ORA-29278: SMTP transient error: 421 Service not available" When Using UTL_SMTP to Send Email.
Regard
Helios -
ORA-29278: SMTP transient error: 421 Service not available
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 advanceIt 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 -
Sending mail from using utl_smtp error......
Hi
When i try to send mail like as follows
DECLARE
v_connection UTL_SMTP.CONNECTION;
BEGIN
v_connection := UTL_SMTP.OPEN_CONNECTION('xxx.xxx.xxx.xxx',25);
UTL_SMTP.HELO(v_connection,'xxx.xxx.xxx.xxx');
UTL_SMTP.MAIL(v_connection,'[email protected]');
UTL_SMTP.RCPT(v_connection,'[email protected]');
UTL_SMTP.DATA(v_connection,'Sent From PL/SQL');
UTL_SMTP.QUIT(v_connection);
END;
I get the following error..
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 96
ORA-06512: at "SYS.UTL_SMTP", line 138
ORA-06512: at line 4
if i send mail from outlook it goes...the configuration is like this
in mail properties general tab
email address : [email protected]
and i have to tick mark the "include this account when receiving mail or synchro" option
in servers tab
POP3 : xxx.xxx.xxx.xxx
smtp : xxx.xxx.xxx.xxx
and i have to tick the "My server requires authentication" option
and have to give the setting for that also
ie. log on using account : [email protected]
password: xxxxxx
How to Correct it ?
Krisi am on the same platform and in same account..... and PL/SQL UTL_SMTP gets a connection plus SMTP error, while telnet cannot even get a connection. A very weird one. Not sure what the problem can be.
Worse case, forget telnet and do all your troubleshooting using UTL_SMTP.. with liberal usage of DBMS_OUTPUT. :-)
regd. the connection from my xp client it is
connecting to the telnet server on server, but when i
tri to connect to the ISP's smtp address it throws
the errorNot that strange. You're likely going through a proxy of sorts of to reach the ISP mail server. Besides, to send mail you should be able to use your company's SMTP server as it should route Internet e-mail out to the net automatically.
In fact, many SMTP servers will not allow you to relay via them. E.g. if you connect from domain 1 to SMTP server on domain 2, and you submit an e-mail to be delivered to domain 3, the domain 2 server will tell you to take a hike. It will only accept mail that is destined for its own domain or originating from its own domain.
Reason for this is spam. Open relays are one of the prime reasons for having billions of spam mails being transmitted.
The correct method will be for you on domain 1 to connect to domain 1's SMTP server and submit an e-mail to be delivered to domain 3. That will be accepted and delivered. Using domain 2 as an intermediate agent to act as a relay, is/should not be accepted by all SMTP servers. (your SMTP server should get blacklisted/blackholed if it has an open relay) -
How can I solve ORA-29278: SMTP transient error: 421 Service not available
Hi
I have two different Solaris Server (Server1 & server2).
In both the server SMTP server is configured.
In these two solaris server (Server1 & server2) we have installed Oracle 9i
I am using client machine to execute the following procedure.
When I connect to server1 (using SQL plus) and execute the following procedure, it works fine, and able to send emails properly.
But when I connect to server2 (using SQL plus) and execute the following procedure, I get the follwoing error.
Could you please help me to resolve this?
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> set define off
SQL> set serveroutput on size 1000000
SQL> BEGIN
2 mail_files( 'localhost',
3 'Frm',
4 '[email protected]',
5 'From production',
6 'Test message from production',
7 9999999999,
8 NULL,
9 NULL,
10 NULL,
11 0 );
12 END;
13 /
BEGIN
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 96
ORA-06512: at "SYS.UTL_SMTP", line 327
ORA-06512: at "PROD_L.MAIL_FILES", line 238
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at line 2
SQL>Hi
I have two different Solaris Server (Server1 & server2).
In both the server SMTP server is configured.
In these two solaris server (Server1 & server2) we have installed Oracle 9i
I am using client machine to execute the following procedure.
When I connect to server1 (using SQL plus) and execute the following procedure, it works fine, and able to send emails properly.
But when I connect to server2 (using SQL plus) and execute the following procedure, I get the follwoing error.
Could you please help me to resolve this?
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> set define off
SQL> set serveroutput on size 1000000
SQL> BEGIN
2 mail_files( 'localhost',
3 'Frm',
4 '[email protected]',
5 'From production',
6 'Test message from production',
7 9999999999,
8 NULL,
9 NULL,
10 NULL,
11 0 );
12 END;
13 /
BEGIN
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 96
ORA-06512: at "SYS.UTL_SMTP", line 327
ORA-06512: at "PROD_L.MAIL_FILES", line 238
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at line 2
SQL> -
ORA-29278: SMTP transient error:421 Service not available on oracle 10g
HIi,
I am trying to send e-mails by using PL/Sql procedure . I am using UTL_MAIL/UTL_SMTP on oracle 10g R1 database.
There is no problem in creating procedure,but when i am doing execution i am getting the mention error.
I am trying to send mail with attachment as excel file.
ORA-20001: The following error has occured: ORA-29278: SMTP transient error:
421 Service not available
ORA-06512: at "SCOTT.MAIL_ATT_RAW", line 64
ORA-06512: at line 1
-----my procedure code------
CREATE OR REPLACE PROCEDURE mail_att_raw(filename varchar2) AS
fil BFILE;
file_len PLS_INTEGER;
MAX_LINE_WIDTH PLS_INTEGER := 54;
buf RAW(2100);
amt BINARY_INTEGER := 2000;
pos PLS_INTEGER := 1; /* pointer for each piece */
filepos PLS_INTEGER := 1; /* pointer for the file */
filenm VARCHAR2(50) := filename; /* binary file attachment */
data RAW(2100);
chunks PLS_INTEGER;
len PLS_INTEGER;
modulo PLS_INTEGER;
pieces PLS_INTEGER;
err_num NUMBER;
err_msg VARCHAR2(100);
resultraw RAW(32000);
BEGIN
/* Assign the file a handle */
fil := BFILENAME('BFILE_DIR', filenm);
/* Get the length of the file in bytes */
file_len := dbms_lob.getlength(fil);
/* Get the remainer when we divide by amt */
modulo := mod(file_len, amt);
/* How many pieces? */
pieces := trunc(file_len / amt);if (modulo <> 0) then
pieces := pieces + 1;end if;/* Open the file */
dbms_lob.fileopen(fil, dbms_lob.file_readonly);/* Read the first amt into the buffer */
dbms_lob.read(fil, amt, filepos, buf);/* For each piece of the file . . . */
FOR i IN 1..pieces LOOP/* Position file pointer for next read */
filepos := i * amt + 1;/* Calculate remaining file length */
file_len := file_len - amt;/* Stick the buffer contents into data */
data := utl_raw.concat(data, buf);/* Calculate the number of chunks in this piece */
chunks := trunc(utl_raw.length(data) / MAX_LINE_WIDTH);/* Don't want too many chunks */
IF (i <> pieces) THEN
chunks := chunks - 1;
END IF;/* For each chunk in this piece . . . */
FOR j IN 0..chunks LOOP/* Position ourselves in this piece */
pos := j * MAX_LINE_WIDTH + 1;/* Is this the last chunk in this piece? */
IF (j <> chunks) THEN len := MAX_LINE_WIDTH;
ELSE
len := utl_raw.length(data) - pos + 1;
IF (len > MAX_LINE_width) THEN
len := MAX_LINE_WIDTH;
END IF;
END IF;/* If we got something, let's write it */
IF (len > 0 ) THEN
resultraw := resultraw || utl_raw.substr(data, pos, len);
END IF;
END LOOP;/* Point at the rest of the data buffer */
IF (pos + len <= utl_raw.length(data)) THEN
data := utl_raw.substr(data, pos + len);
ELSE
data := NULL;
END IF;/* We're running out of file, only get the rest of it */
if (file_len < amt and file_len > 0) then
amt := file_len;
end if;/* Read the next amount into the buffer */dbms_lob.read(fil, amt, filepos, buf);
END LOOP;/* Don't forget to close the file */
dbms_lob.fileclose(fil);
SYS.UTL_MAIL.SEND_ATTACH_RAW(sender => '[email protected]', recipients => '[email protected]',subject => 'Testmail', message => 'Hallo', attachment => resultraw, att_filename => filename);
EXCEPTION
WHEN OTHERS THEN--dbms_output.put_line('Fehler');
raise_application_error(-20001,'The following error has occured: ' || sqlerrm);
END;
Please suggest me what settings i need to change. This same procedure is running on another maching,but not on my machine.
If somebody is having any other simple procedure ,please help me.
My SMTP port -25
Thanks in advance.Hi Justin,
Please get the answers of your queries
The error you're getting is coming from the SMTP server you are trying to connect to.
- What SMTP server is your database configured to use?
Reply - I am using IIS(5.0)
- What SMTP server is the database where this code is working configured to use?
Reply - Same IIS. Database is installed locally on my machine only. I am trying to send mail locally to me only,Not to the outside person.
- Has the SMTP server been configured to allow connections from both machines?
Reply - Yes
One more query, do we really require to set the SMTP_OUT_SERVER parameter for SCOPE=BOTH
ALTER SYSTEM SET smtp_out_server = '172.16.1.10' SCOPE=BOTH
I am not able to set like this for BOTH,only for SPFILE i can set ?.
My SMTP Server IP=172.16.1.10
PORT- 25
Thanks
Manoj -
Hi all,
We are trying to FTP files from business connector at regular interval to external party via proxy and sometimes we face a error - 421 Service not available, closing control connection.
Please help to know what could be the cause for this, as this happens during few transmissions and remaining time we are able to FTP with out any problem.
I tried to check the size of the files transmitted and is not different than the successful transmission. Also, due to this error we are not able read or put the files to external FTP server.
Please help.Hi Bindu,
do chk this link
Error during disconnect from FTP Server
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ee5bc490-0201-0010-e9b5-a258cf083bca
Regards
Sampath -
My BTYahoo mail is working fine via Outlook 2013 where I can send a set of e-mails (around 40) via the BCC option.
However, I have a third party e-mailer which sends each of the selected e-mail addresses separately on pressing its send button, unlike a BCC option.
This has been working fine since the summer and since I transferred to a new Windows 8.1 computer.
But during the week, when sending a batch, the e-mailer reported the following error. The supplier does not think it is a software problem with his product.
Error 421. 421 Service not available - too many authenticated connections
Googling has not found this error.
Sending a second (dfferent) batch the next day was successful, but a third (different again) batch failed with the same error.
What does the error mean?
Russell DarlingRussellDarling wrote:
My BTYahoo mail is working fine via Outlook 2013 where I can send a set of e-mails (around 40) via the BCC option.
However, I have a third party e-mailer which sends each of the selected e-mail addresses separately on pressing its send button, unlike a BCC option.
This has been working fine since the summer and since I transferred to a new Windows 8.1 computer.
But during the week, when sending a batch, the e-mailer reported the following error. The supplier does not think it is a software problem with his product.
Error 421. 421 Service not available - too many authenticated connections
Googling has not found this error.
Sending a second (dfferent) batch the next day was successful, but a third (different again) batch failed with the same error.
What does the error mean?
Russell Darling
Hi. Welcome to the forums.
Can you say how many email addresses are in each batch ?, e.g. was the 1st and 3rd batches much larger than the 2nd ?
What is the 3rd party emailer ?
After sending to the batch that failed - were you still able to send single emails ?
What sort of smtp settings do you have with your email address (e.g. port, SSL etc) ? Users' email addresses are changing properly to CP shortly, and this could affect the way you send emails depending on settings - though this would probably show with all batches.
http://www.andyweb.co.uk/shortcuts
http://www.andyweb.co.uk/pictures -
Endpoint shutdown (FTP) on web exception. FTP error 421
Hi,
When using FTP Source in my Biztalk Services project it sometimes occurs that we receive an error 421 from the FTP server. This causes the endpoint to shutdown, which will result in a manual action to restart the endpoint again.
We're looking into the cause of the 421 error, but the strange thing is that 4 bridges within the same project use the same FTP server, but they do not all shutdown. This makes it assumable that it's a short hickup in the system.
Is there a way to set a strategy of backoff and retrying instead of shutting down the endpoint for FTP errors ? I my opinion, /I shouldn't need to rely on a 3rd party to keep my infrastructure running.The bridge will shut down after retry attempts at delayed polling intervals.
You may want to monitor Operation Logs / Event logs for such events.
You may write a simple PS script which can run periodically to start the bridges and make sure that the bridges are in started state.
http://msdn.microsoft.com/en-us/library/azure/dn232351.aspx
regards,
Shailesh Agre -
ORA-29278: SMTP transient error: 421 Too many concurrent SMTP
Hi Gurus,
I'm send emails by using UTL_MAIL in oracle 10g but some time I got this error
ORA-29278: SMTP transient error:
421 Too many concurrent SMTP connections;
please try again later
my database detail are as under
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
please help to resolve this issue.
Thanks in advance
sadiqCREATE OR REPLACE PROCEDURE production_status_email
AS
v_sender VARCHAR2 (100) := '[email protected]';
v_recipients VARCHAR2 (100) := '[email protected]';
v_cc VARCHAR2 (200) := '[email protected]';
v_date date default sysdate-1;
v_subj VARCHAR2 (200) := 'Production Status of ' || to_date(v_date);
l_mesg LONG := NULL;
v_mtype VARCHAR2 (30) := 'text/html; charset=us-ascii';
l_greetings LONG := NULL;
l_table_heading LONG := NULL;
l_table_data LONG := NULL;
l_line_total LONG := NULL;
l_line_bpcs LONG := NULL;
l_table_footer LONG := NULL;
l_regards LONG := NULL;
n_row_counter NUMBER := 0;
n_sr_counter NUMBER := 1;
d_date DATE;
n_sum_frozen_quantity NUMBER;
n_sum_plan_quantity NUMBER;
n_sum_achieve_quantity NUMBER;
n_sum_price NUMBER;
n_sum_b_pieces NUMBER;
n_sum_b_price NUMBER;
BEGIN
l_greetings :=
'<p>Dear sir,</p>'
||'<p>Following is Production Status of '
|| v_date
|| '</p>
l_table_heading :=
'<table border = "1" cellpadding="1" width="100%" >
<tr bgcolor="CYAN"><font size="2" face="times" color="BLUE">
<th align="LEFT" width="100">Main Resource</th>
<th align="LEFT" width="150">Sub Resource</th>
<th align="LEFT" width="60">UOM</th>
<th align="RIGHT" width="100">Frozen Quantity</th>
<th align="RIGHT" width="100">Plan Quantity</th>
<th align="RIGHT" width="100">Acheived Quantity</th>
<th align="RIGHT" width="100">Amount</th>
<th align="LEFT">Reason</th></tr>';
FOR mr IN (SELECT DISTINCT mrno, mresource
FROM image.production_status_v
WHERE pdate = TO_DATE (v_date)
ORDER BY 1)
LOOP
l_table_data :=
l_table_data
|| '<tr><font size="2" face="times"><th align="LEFT">'
|| mr.mresource
|| '</th>';
n_sr_counter := 1;
FOR sr IN (SELECT srno, sresource, uom, frozen_quantity, plan_quantity, achieve_quantity,price,
remarks
FROM image.production_status_v sr
WHERE mresource = mr.mresource
AND pdate = TO_DATE (v_date)
ORDER BY srno)
LOOP
IF n_sr_counter > 1
THEN
l_table_data := l_table_data || '</font></tr>';
l_table_data :=
l_table_data || '<tr><font size="2" face="times"><td></td>';
END IF;
l_table_data :=
l_table_data
|| '<td align="LEFT">'
|| sr.sresource
|| '</td>'
|| '<td align="LEFT">'
|| sr.uom
|| '</td>'
|| '<td align="RIGHT">'
|| TO_CHAR (sr.frozen_quantity, '99,999,999')
|| '</td>'
|| '<td align="RIGHT">'
|| TO_CHAR (sr.plan_quantity, '99,999,999')
|| '</td>'
|| '<td align="RIGHT">'
|| TO_CHAR (sr.achieve_quantity, '99,999,999')
|| '</td>'
|| '<td align="RIGHT">'
|| TO_CHAR (sr.price, '99,999,999')
|| '</td>'
|| '<td align="LEFT">'
|| sr.remarks
|| '</td>';
n_sr_counter := n_sr_counter + 1;
n_row_counter := n_row_counter + 1;
END LOOP;
l_table_data := l_table_data || '</font></tr>';
IF n_sr_counter > 2
THEN
SELECT SUM (frozen_quantity)
INTO n_sum_frozen_quantity
FROM image.production_status_v
WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
SELECT SUM (plan_quantity)
INTO n_sum_plan_quantity
FROM image.production_status_v
WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
SELECT SUM (achieve_quantity)
INTO n_sum_achieve_quantity
FROM image.production_status_v
WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
SELECT SUM (price)
INTO n_sum_price
FROM image.production_status_v
WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
l_line_total :=
'<tr bgcolor="#F0F0F0"><font size="2" face="times" color="BLUE">'
|| '<th align="RIGHT" colspan="3">Total</th>'
|| '<th align="RIGHT">'
|| TO_CHAR (n_sum_frozen_quantity, '99,999,999')
|| '</th><th align="RIGHT">'
|| TO_CHAR (n_sum_plan_quantity, '99,999,999')
|| '</th><th align="RIGHT">'
|| TO_CHAR (n_sum_achieve_quantity, '99,999,999')
|| '</th><th align="RIGHT">'
|| TO_CHAR (n_sum_price, '99,999,999')
|| '</th>
</font></tr>';-- <td></td>
l_table_data := l_table_data || l_line_total;
END IF;
IF mr.mresource = 'Stitching' then
SELECT SUM(bqr)
into n_sum_b_pieces
from image.bundle2
WHERE to_date(bqr_date) = TO_DATE (v_date);
SELECT SUM(bqr * (SELECT ROUND (oe.price * er.rate)
FROM orderent oe, ex_rate er
WHERE oe.currency = er.currency
AND oe.order# =
SUBSTR (b2.order#, 1, 7)))
into n_sum_b_price
from image.bundle2 b2
WHERE to_date(bqr_date) = TO_DATE (v_date);
l_line_bpcs :=
'<tr bgcolor="#F0F0F0"><font size="2" face="times" color="BLUE">'
|| '<th align="RIGHT" colspan="3">B Pieces</th>'
|| '<th align="RIGHT">'
|| ''
|| '</th><th align="RIGHT">'
|| ''
|| '</th><th align="RIGHT">'
|| TO_CHAR (n_sum_b_pieces, '99,999,999')
|| '</th><th align="RIGHT">'
|| TO_CHAR (n_sum_b_price, '99,999,999')
|| '</th>
</font></tr>';-- <td></td>
l_table_data := l_table_data || l_line_bpcs;
END IF;
END LOOP;
l_table_footer := '</table>';
--------------------------regards sectionstarts-
l_regards :=
'<p><font color="BLUE"><Address><br> Regards,<br> Information Systems
</address></font>';
-----------------------regards section ends;
l_mesg :=
l_mesg
|| l_greetings
|| l_table_heading
|| l_table_data
|| l_table_footer
|| l_regards;
IF n_row_counter > 0
THEN
UTL_MAIL.send (v_sender,
v_recipients,
v_cc,
NULL,
v_subj,
l_mesg,
v_mtype,
NULL
END IF;
END;
/ -
Error "421 #4.4.5 Too many connections from your host"
We have deployed a Java application using JavaMail which enables people to send email to their contact lists. It has been in use for a few years, various updates being applied over that time. Most of our customers have no problem. But a couple of weeks ago, two of them suddenly could no longer send emails.
The connection to the SMTP server works but when the application sends email, it gets an error 421. A debugging dump is reproduced below: the target email address is changed to protect the uninvolved; messages starting with **** come from my program, other come from JavaMail.
Can anyone solve this problem? suggest where to look? Thanks.
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp10.bellnet.ca", port 25, isSSL false
220 toip35-bus.srvr.bell.ca ESMTP
DEBUG SMTP: connected to host "smtp10.bellnet.ca", port: 25
EHLO Communications
250-toip35-bus.srvr.bell.ca
250-8BITMIME
250 SIZE 20971520
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "SIZE", arg "20971520"
**** transport connect worked
NOOP
250 ok
**** about to send message to [email protected]
NOOP
250 ok
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
**** cEmailAuthenticator.getPasswordAuthentication() called
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp10.bellnet.ca", port 25, isSSL false
421 #4.4.5 Too many connections from your host.
DEBUG SMTP: could not connect to host "smtp10.bellnet.ca", port: 25, response: 4Looks like the server keeps track of the number of connections from each machine, and when the number of connections in a certain period exceeds some number, that machine is deemed to be a potential spammer. At any rate it is something you should discuss with the manager of that server.
-
UTL_SMTP - Error while using Cc
Hi All,
I have got a issue regarding sending mails via pl/sql. Unable to add an mail id using Cc. The procedure looks something like this.
CREATE OR REPLACE PROCEDURE test_mail is
mailhost VARCHAR2(100) := 'GASVREXC01';
conn UTL_SMTP.CONNECTION;
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
mesg VARCHAR2( 1000 );
BEGIN
conn:= utl_smtp.open_connection( mailhost, 25 );
utl_smtp.helo( conn, mailhost );
utl_smtp.mail( conn, '[email protected]' );
utl_smtp.rcpt( conn, '<[email protected]>' );
utl_smtp.rcpt( conn, 'Cc:[email protected]' );
mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
'From: User1 <[email protected]>' || crlf ||
'Subject: Just testing' || crlf ||
'To: Biju Varghese <[email protected]>' || crlf ||
'Cc: Biju <[email protected]>' || crlf ||
'' || crlf ||
' This is just a test, please disregard. ' || crlf ||
utl_smtp.data( conn, mesg );
utl_smtp.quit( conn );
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
utl_smtp.quit(conn);
raise_application_error(-20000,
'Failed tosend mail due to the following error: ' || sqlerrm);
WHEN OTHERS THEN
raise_application_error(-20001,
'The following error has occured: ' || sqlerrm);
END;
Procedure created.
SQL> execute test_mail;
BEGIN test_mail; END;
ERROR at line 1:
ORA-20000: Failed tosend mail due to the following error: ORA-29279: SMTP
permanent error: 553 malformed address: bcc:[email protected]
ORA-06512: at "SYS.TEST_MAIL", line 28
ORA-06512: at line 1
Can someone help me out, as how can i use a Cc feature. We are using Microsoft Outlook. If i comment the line for Cc it works fine. Any help would be gr8
Thanks
BijuCan you back that statement about an Oracle UTL_SMTP bug up with an actual bug number??
From what you have posted, this is not a bug!! but expected and documented (RFC'ed) SMTP server behaviour.
My proof:
/home/billy> telnet mail 25
Trying 165.143.128.26...
Connected to mail
Escape character is '^]'.
220 CNTRRA20-GTW01 [CNTRRA20-GTW01] Thu, 06 Mar 2008 14:26:26 +0200
HELO 10.251.93.58
250 CNTRRA20-GTW01 Hello [10.251.93.58]
MAIL FROM: naveen <[email protected]>
501 naveen <[email protected]> : illegal character(s) in domain string
MAIL FROM: NAVEEN
501 NAVEEN : domain string is NULL.
quit
221 CNTRRA20-GTW01 closing connection. Goodbye!
Connection closed by foreign host.
/home/billy>
As you can clearly see, the SMTP server expects a DOMAIN name as part of the MAIL FROM address. It also does not accept the alternative format suggested.
Yes, not all SMTP servers are equal and some support additional formatting.
But to imply that because the SMTP server does not accept your address formatted as string NAVEEN, it is a UTL_SMTP problem, sounds like a smelly one to me.
Maybe you are looking for
-
Cannot print to Color Laserjet Pro MFP M177fw
I have a HP Color Laserjet MFP M177fw hard wired to my router. I can print from internet explorer, chrome and other applications such as Office and Notepad, etc. I cannot print from Adobe Acrobat Pro XI. I can get to the print dialogue page and hit p
-
Issue with BATCH SPLIT with Inbound Delivery
Hi, We are in an SAP upgrade project from 4.7 to ECC 6.0, we would require to develop an Interface Program to perform BATCH SPLIT for an Inbound Delivery, I tried with BAPI BAPI_INB_DELIVERY_CHANGE but it seems to be work only to change the existing
-
Complement on Cover Art for Main Lightroom Page
Would really like to complement Adobe on the cover art found on the main Adobe Photoshop Lightroom 2 marketing page. Very understated, professional, elegant. Just found it extemely interesting. The stark contrast in marketing style from before. A cla
-
Setting slide choices in iPhoto 11
I'm making a slideshow in iPhoto 11 using the Scrapbook theme. Is there any way to choose how many photo display per page? Some have 1, 2 or 3. It doesn't seem like I have any control over how many appear together.. but would really like to.
-
CATS_DA Processing Status field
Hi, Experts: Is there a way to display the description of the processing status field in tcode CATS_DA? I would rather have the numerical code and text instead of the color-coded icon. Anyone have a response on this?? thanks, Jack Edited by: HCM_J