Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: ORA-20002: 501 Bad address syntax
schumacherfan2003_at_yahoo.com (leo) wrote in message news:<79d24144.0304232051.688b8818_at_posting.google.com>...
> Hi,
>
> I intend to send a simple smtp mail using the builtin UTL_SMTP package.
>
> But i get the following error:-
> ORA-20002: 501 Bad syntax error
>
> Here is my code:-
> CREATE OR REPLACE PROCEDURE mail
> IS
> BEGIN
> DECLARE
> v_connection UTL_SMTP.CONNECTION;
>
> BEGIN v_connection := UTL_SMTP.OPEN_CONNECTION(<my host here>,25);
> dbms_output.put_line('Connection Opened');
>
> UTL_SMTP.HELO(v_connection,<my host here>);
> dbms_output.put_line('After calling helo');
>
> UTL_SMTP.MAIL(v_connection,'test_at_myhost.com');
> dbms_output.put_line('Sender set');
>
> UTL_SMTP.RCPT(v_connection,'test1_at_myhost.com');
> dbms_output.put_line('Recipient Set');
>
> UTL_SMTP.DATA(v_connection,'Sent From PL/SQL');
> dbms_output.put_line('Message body set');
>
> UTL_SMTP.QUIT(v_connection);
> dbms_output.put_line('Connection Closed');
> end;
> END;
> /
>
> Here is the output:-
>
> SQL> exec mail
> Connection Opened
> After calling helo
> BEGIN mail; END;
>
> *
> ERROR at line 1:
> ORA-20002: 501 Bad address syntax
> ORA-06512: at "SYS.UTL_SMTP", line 86
> ORA-06512: at "SYS.UTL_SMTP", line 204
> ORA-06512: at "ADMIN.MAIL", line 13
> ORA-06512: at line 1
>
>
> I tried sending mails to my smtp server via java mailing API and i am
> successful. So i am wondering wat i am doing wrong up there in Oracle.
> I have JServer enabled, i also ran the initplsj.sql successfully.
I've seen this on some SMTP servers. For instance, Yahoo mail server is configured this way to disallow a simple MAIL FROM: myaddress_at_mydomain.com:
$ telnet mx1.mail.yahoo.com 25
Trying 64.157.4.84...
Connected to mx1.mail.yahoo.com.
Escape character is '^]'.
220 YSmtp mta576.mail.yahoo.com ESMTP service ready
helo yong321_at_yahoo.com
250 mta576.mail.yahoo.com
mail from:yong321_at_yahoo.com
501 Syntax error in parameters or arguments
But other mail servers allow this (I changed my company to <mycompany>):
$ telnet mx.nyc.untd.com 25 #netzero.com mail server
Trying 64.136.20.83...
Connected to mx.nyc.untd.com.
Escape character is '^]'.
220 mx11.nyc.untd.com ESMTP
helo yong321_at_yahoo.com
250 mx11.nyc.untd.com Hello <mycompany>.com pleased to meet you
mail from:yong321_at_yahoo.com
250 yong321_at_yahoo.com... Sender OK
quit
221 mx11.nyc.untd.com Closing connection
Connection closed by foreign host.
I have yet to find the answer. Try another mail server. Ask the question on comp.mail.sendmail.
Yong Huang Received on Mon Apr 28 2003 - 16:58:10 CDT
![]() |
![]() |