Home » SQL & PL/SQL » SQL & PL/SQL » best way to send an email in oracle (Oracle 10g)
best way to send an email in oracle [message #582971] Wed, 24 April 2013 02:08 Go to next message
sss111ind
Messages: 480
Registered: April 2012
Location: India
Senior Member

Hi All,

what is the best way to send an email in oracle?

1.utl_smtp
2.utl_mail
3.utl_tcp

Regards,
Nathan
Re: best way to send an email in oracle [message #582972 is a reply to message #582971] Wed, 24 April 2013 02:19 Go to previous messageGo to next message
Michel Cadot
Messages: 59118
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
UTL_MAIL, of course, it is its purpose, if you are not limited by its restrictions.

Regards
Michel
Re: best way to send an email in oracle [message #582977 is a reply to message #582972] Wed, 24 April 2013 03:03 Go to previous messageGo to next message
sss111ind
Messages: 480
Registered: April 2012
Location: India
Senior Member

But Michel,

But I am getting following error.
BEGIN
  UTL_MAIL.SEND ( 'abc@gmail.com',--sender      IN    VARCHAR2 CHARACTER SET ANY_CS,
  'sss111ind@gmail.com',          --recipients  IN    VARCHAR2 CHARACTER SET ANY_CS,
  'sss111ind@gmail.com',          --cc          IN    VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
  'sss111ind@gmail.com',          --bcc         IN    VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
  'mail test',                    --subject     IN    VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
  'mail test',                    --message     IN    VARCHAR2 CHARACTER SET ANY_CS,
  'text/plain; charset=us-ascii', 1);
END; 

Error starting at line 1 in command:
BEGIN
  UTL_MAIL.SEND ( 'abc@gmail.com',--sender      IN    VARCHAR2 CHARACTER SET ANY_CS,
  'sss111ind@gmail.com',          --recipients  IN    VARCHAR2 CHARACTER SET ANY_CS,
  'sss111ind@gmail.com',          --cc          IN    VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
  'sss111ind@gmail.com',          --bcc         IN    VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
  'mail test',                    --subject     IN    VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
  'mail test',                    --message     IN    VARCHAR2 CHARACTER SET ANY_CS,
  'text/plain; charset=us-ascii', 1);
END; 
Error report:
ORA-06550: line 2, column 3:
PLS-00201: identifier 'UTL_MAIL.SEND' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:


Regards,
Nathan
Re: best way to send an email in oracle [message #582981 is a reply to message #582977] Wed, 24 April 2013 04:09 Go to previous messageGo to next message
Michel Cadot
Messages: 59118
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Check:
1/ The package is installed (it is not by default)
2/ You have access right on it

Regards
Michel
Re: best way to send an email in oracle [message #582984 is a reply to message #582981] Wed, 24 April 2013 06:08 Go to previous messageGo to next message
sss111ind
Messages: 480
Registered: April 2012
Location: India
Senior Member


Thanks Michel,

How can I check and install the specified package.And why it is not there by default though every package is there in Oracle I guess.


Regards,
Nathan
Re: best way to send an email in oracle [message #582985 is a reply to message #582971] Wed, 24 April 2013 06:24 Go to previous messageGo to next message
ashwani0301
Messages: 44
Registered: March 2013
Location: Karnatka, Bangalore
Member
Hi sss111ind,

Please find the information about the installation of the package link below.

http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_mail.htm


Thanks
Re: best way to send an email in oracle [message #582986 is a reply to message #582984] Wed, 24 April 2013 07:07 Go to previous message
Michel Cadot
Messages: 59118
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
sss111ind wrote on Wed, 24 April 2013 13:08

Thanks Michel,

How can I check and install the specified package.And why it is not there by default though every package is there in Oracle I guess.


Regards,
Nathan


1/ Check: query dba_objects
2/ Install: run utlmail.sql and prvtmail.plb
3/ why: why not?
4/ why: no, not all packages are installed by default

Regards
Michel

Previous Topic: How to use a function
Next Topic: Display conditional column values
Goto Forum:
  


Current Time: Wed Sep 17 17:33:11 CDT 2014

Total time taken to generate the page: 0.07251 seconds