?
Solved

Sending email from Oracle PL/SQL

Posted on 2003-03-13
4
Medium Priority
?
669 Views
Last Modified: 2012-05-04
While trying to send email from Oracle Database I keep getting the following message.

ORA-20002: 553 Invalid RFC821 mailbox specification.

****
    This is the line of code that is returning the error.
    utl_smtp.rcpt(mailcomm, tooadd);
***

Any help is appreciated

Thanks
0
Comment
Question by:rajanvora
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
belem earned 500 total points
ID: 8131949
Hi,

have you got more information?


yor variable mailcomm must have the type utl_smtp.open_connection

Example:
mailcomm:= utl_smtp.open_connection(192.168.1.1, 25);
and


your Variable tooadd is the email-adress of the Recepient.

Example: 'abc@gmx.net'


0
 

Assisted Solution

by:RamaDevi
RamaDevi earned 500 total points
ID: 8156902
Yes. I am OK with belem. The following example can help you more. Use the following call to execute the same.

execute SENDMAIL('to_mail@yahoo.com','oracle','subject','message');


CREATE or replace PROCEDURE SENDMAIL (TOO IN VARCHAR2, FROMM IN VARCHAR2,
   SUBJECT IN VARCHAR, BODY IN VARCHAR) AS

  CONN        UTL_SMTP.CONNECTION;
-- Set this to your SMTP mail server.
  SMTP_HOST   VARCHAR2(50)    := '127.0.0.1';
  PORT        VARCHAR2(2)     := 25;
  MSG_HEADER  VARCHAR2(2000)  := null;
  CR          VARCHAR2(2)     := chr(10)||chr(13);
  MSG_BODY    VARCHAR2(4000);

BEGIN
  CONN := UTL_SMTP.OPEN_CONNECTION(SMTP_HOST, PORT);
  MSG_HEADER := 'Date: ' ||
  TO_CHAR(SYSDATE, 'dd-Mon-yy hh24:mi:ss') || CR ||
  'From: <'||FROMM||'>' || CR ||
  'Subject: '||SUBJECT|| CR ||
  'To: '||TOO || CR ||
  '' || CR;

  MSG_BODY := MSG_HEADER || BODY;

  UTL_SMTP.HELO(CONN, SMTP_HOST);
  UTL_SMTP.MAIL(CONN, FROMM);
  UTL_SMTP.RCPT(CONN, TOO);
  UTL_SMTP.DATA(CONN, MSG_BODY);
  UTL_SMTP.QUIT(CONN);

END;
/
0
 
LVL 13

Expert Comment

by:anand_2000v
ID: 10094078
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: belem {http:#8131949} & RamaDevi {http:#8156902}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

anand_2000v
EE Cleanup Volunteer
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question