Send mail through PL/SQL
hi,
I am working in oracle9i and linux 2.4. I need to send a mail from pl/sql along with attachments.
I wrote a pl/sql procedure about how to send a mail with out attachments..
but i want to send a mail from pl/sql along with (csv )attachments ..
That file we have to retrive it from the Directory in the database and to send it through pl/sql using smtp configuration....
Regs
APC,
When I was making use of your sample on OTN that is called 'demo_mail.sql', I got these issues (when compiling the package header against one 10g DB)
21/19 PL/SQL: Declaration ignored
21/65 PLS-00201: identifier 'UTL_TCP' must be declared
22/19 PL/SQL: Declaration ignored
23/47 PLS-00201: identifier 'UTL_TCP' must be declared
47/3 PL/SQL: Declaration ignored
52/16 PLS-00201: identifier 'UTL_SMTP' must be declared
55/3 PL/SQL: Declaration ignored
55/46 PLS-00201: identifier 'UTL_SMTP' must be declared
60/3 PL/SQL: Declaration ignored
60/49 PLS-00201: identifier 'UTL_SMTP' must be declared
64/3 PL/SQL: Declaration ignored
64/45 PLS-00201: identifier 'UTL_SMTP' must be declared
72/3 PL/SQL: Declaration ignored
72/52 PLS-00201: identifier 'UTL_SMTP' must be declared
81/3 PL/SQL: Declaration ignored
81/54 PLS-00201: identifier 'UTL_SMTP' must be declared
95/3 PL/SQL: Declaration ignored
95/57 PLS-00201: identifier 'UTL_SMTP' must be declared
102/3 PL/SQL: Declaration ignored
102/47 PLS-00201: identifier 'UTL_SMTP' must be declared
Bst Rgds,
HuaMin
Similar Messages
-
Sending mails through PL/SQL in different domains
Hi all,
I am having procedure like this.....
create or replace procedure send_test_message
IS
mailhost VARCHAR2(64) := 'xxx.com';
sender VARCHAR2(64) := '[email protected]';
recipient VARCHAR2(64) := '[email protected]'; /* Error comes in this */
--recipient VARCHAR2(64) := '[email protected]'; /* This is working fine */
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
-- If we had the message in a single string, we could collapse
-- open_data(), write_data(), and close_data() into a single call to data().
utl_smtp.open_data(mail_conn);
utl_smtp.write_data(mail_conn, 'This is a test message.' || chr(13));
utl_smtp.write_data(mail_conn, 'This is line 2.' || chr(13));
utl_smtp.close_data(mail_conn);
utl_smtp.quit(mail_conn);
dbms_output.put_line('Successfully sends......');
EXCEPTION
WHEN OTHERS THEN
-- Insert error-handling code here
dbms_output.put_line(sqlerrm);
END;
When i called this procedure, i am getting following error....
ORA-29279: SMTP permanent error: 550 5.7.1 [email protected].. Relaying denied. IP name lookup failed [219.120.53.234]
[email protected] -- This mail id is mine and it exists.
Any help is appreciated.
Thanks in advance,
Pal> May be silly for you, but i like to know,
Anybody (different provider/domain) can send mails through his mobile to my
mobile (different provider/domain). How it is possible ?
I send an e-mail to you. My mail reader contacts my e-mail server. The e-mail server sees that I'm from the same domain. It accepts my e-mail - it ignores (for now) what the recipient's domain are.
My domain's e-mail server looks at the recipient and sees your domain. It now attempts to contact your domain's e-mail server. If it fails, it sends me an e-mail telling me of that failure.
If it succeeds, it tells your e-mail server that it has an e-mail for you from me. Your e-mail server sees that the recipient is on its domain. It therefore accepts the e-mail and delivers it to your post box. Your e-mail server is not concerned about the originator (me and my domain) as the delivery is for someone on its domain.
Only when the recipient and sender are both "unknown" to the mail server, it will/should refuse to accept that e-mail and try to relay it between one and another domain.
Bottom line - when sending an e-mail the SMTP server expects that you are either on the same domain as it (in which case it is there to service you), or that you are delivering an e-mail for someone on its domain (that someone being serviced by the server). -
Sending mail through Pl/sql
Followed below steps:
sqlplus sys/<pwd>
SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql
SQL> @$ORACLE_HOME/rdbms/admin/prvtmail.plb
not sure how to define smtp_out_server
alter system set smtp_out_server='nsk-1297dfab529:25';
I have entered the above from my tnsping,
and then
shutdown immeidate;
startup;
then have executed the below code,
SET SERVEROUT ON
BEGIN
UTL_MAIL.send
(sender => '[email protected]',
recipients => '[email protected]',
cc => null,
subject => 'test',
message => 'test email');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.Put_Line('Encountered an Exception'||SQLERRM);
END;
I didn't get any error, any mail, :(
Please help,
Thanks,NSK2KSN wrote:
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.Put_Line('Encountered an Exception'||SQLERRM);
END;Don't do this. It makes no sense. Why do you want to turn an exception into a line of text stored in some package's string variable? This is not how exception handlers should ever be coded.
I didn't get any error, any mail, :(What server o/s are you using? What is the 4 digit Oracle version used?
What happens when you open a console window on the Oracle server and type:
ping nsk-1297dfab529
telnet nsk-1297dfab529 25
Copy and paste the output here using {noformat}{noformat} tags.
PS. Also make sure that you did made the Oracle parameter change permanent. It is safer is to explicitly tell Oracle whether the system change is to be made to memory, parameter file, or both. What is the output in SQL*Plus for the command "+show parameter smtp_out_server+"? -
Sending Mail through Outlook using PL/SQL
I have installed Oracle 9i (9.2.0.1) on Windows Xp with SP 2 platform. My MS Outlook has been configured.
How could i send mail through Microsoft outlook by using PL/SQL Program.How could i send mail through Microsoft outlook by using PL/SQL Program.Nonsensical question. MS Outlook is a mail client. A PL/SQL program is also a mail client.
Both these need to talk to a mail server. It does not make sense for one mail client to "+talk+" to another client for passing it e-mails that need to be send.
The mail client talks to a mail server using the SMTP ( Simple Mail Transfer Protocol ). There are also other protocols such as IMAP (open standard) and MAPI (Microsoft proprietary).
Oracle's PL/SQL environment by default supports SMTP via the UTL_SMTP, and UTL_MAIL packages - these provide the PL/SQL developer with an interface to use to send e-mails.
MS Outlook (client) does not feature anywhere in this regard, whereas MS Exchange as a mail server will (assuming it is being used on your network). -
How to send mail in PL/SQL using exchange server details.
Hi Experts,
Business user has provided us the exchange server details to send mails.How can I send mails thru PL/SQL using exchange server details.user595740 wrote:
Business user has provided us the exchange server details to send mails.How can I send mails thru PL/SQL using exchange server details.Basic answer - not easily.
Oracle supports the standard application protocol SMTP - it does not support a proprietary protocol like that used by Exchange that only works on the Windows operating system. It however provides you with the flexibility to code this yourself.
If you for example use Microsoft MAPI (Mail Application Programming Interface), you can integrate it with PL/SQL using the external procedure (extproc) feature of Oracle.
In a nutshell, extproc enables you to create PL/SQL wrappers for public DLL calls. I posted sample code that demonstrates this in {message:id=2271919}. The sample code is for calling a DLL interface on HP-UX, but the concept is identical on Windows. -
Problem in sending mail through dynamics actions
Hi Friends,
I have a problem in sending mail through dynamics actions . In this we pass a subroutine in dynamics actions which send an mail when promotion action occured.
Problem is that sometimes it will send an mail or sometimes not. I have no idea to solve this problem.
Can anyone suggest me .
Thanks ,
Anish
Moderator message : Duplicate post locked.
Edited by: Vinod Kumar on Sep 5, 2011 9:45 AMHi,
Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
thank You -
Problem in sending mail through workflow
Hi All,
I am trying to create a workflow. I created a workflow and once document is made, this workflow trigerrs and i am able to get user decision to my user id. once if i click on approve, mail should be triggered to my mail id. but mail is not coming to my mail id. i checked in SOST transaction, <b>mail status set to Transmitted.</b>, and not as sent .
But i tested a sample test message from sbwp to my mail id and it is working fine. Only through workflow, sending message to outlook is not working. i checked my user in the system in SU01 transaction also, there also mail id is mentioned. what could be reason for not able to send mails through workflow.?
Its urgent.
Points will be awarded to all.
Regards,
vinothHi,
Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
thank You -
Problem while sending mail through posprocess event hadler inOIM 11g r2
Hi,
i am sending mail through posprocess event hadler inOIM 11g r2 when user is created.But i am getting following error in resolver class.
java.lang.NullPointerException
at oracle.iam.identity.usermgmt.impl.UserDetailsProviderImpl.getUserDetails(UserDetailsProviderImpl.java:102)
at oracle.iam.notification.impl.util.NotificationUtil.getUserPreferences(NotificationUtil.java:83)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:523)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at oracle.iam.platform.utils.DMSMethodInterceptor.invoke(DMSMethodInterceptor.java:25)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at oracle.iam.notification.impl.util.NotificationUtil.getUserPreferences(NotificationUtil.java:83)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:523)
at oracle.iam.notification.impl.NotificationServiceImpl.notify(NotificationServiceImpl.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at oracle.iam.platform.utils.DMSMethodInterceptor.invoke(DMSMethodInterceptor.java:25)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
Edited by: 853559 on Sep 25, 2012 6:27 AMIf you are using Custom Notification XML, make sure to have StaticData element in it. StaticData defines the entitites that can be used in the notification template, and these entities attributes are used to define substitution tokens in the template.
-
Sending mail through a proxy client
I have the following simple code to send mail through a SOCKS proxy client:
package com.apna.beans;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.DataHandler ;
public class SMail{
public static void main(String[]a){
System.setProperty("proxySet","true");
/*System.getProperties().put("http.proxyPort","25");
System.getProperties().put("http.proxyHost","192.168.0.1");*/
Properties props = System.getProperties();
String msg = "";
// Get system properties
final String username = "vedijitendra";
final String password = "sendmail";
props.put("socksProxyHost", "pc-2");
props.put("socksProxyPort", "1080");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.user", username);
props.put("mail.smtp.auth","true"); // this is imp for authorisation.
//props.put("mail.host", "192.168.0.1");
props.put("mail.debug", "true");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
try{
//here the authorisation takes place using an Anonymous class.
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator (){
protected
javax.mail.PasswordAuthentication
getPasswordAuthentication() {
return new
javax.mail.PasswordAuthentication(username,
password);
// Define message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));
message.addRecipient( Message.RecipientType.TO, new
InternetAddress("[email protected]"));
message.setSubject("Test");
message.setContent("text", "text/html");
// Send the message
Transport.send(message);
msg = "The mail has been sent.";
} catch(Exception e){
e.printStackTrace();
msg = "The mail has not been sent.";
I am able to connect to the GMail's SMTP server.
However, when the Transport. send method is executed, I get:
java.lang.NullPointerException
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:242)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1191)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:348)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
Any ideas?I have the following simple code to send mail through a SOCKS proxy client:
package com.apna.beans;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.DataHandler ;
public class SMail{
public static void main(String[]a){
System.setProperty("proxySet","true");
/*System.getProperties().put("http.proxyPort","25");
System.getProperties().put("http.proxyHost","192.168.0.1");*/
Properties props = System.getProperties();
String msg = "";
// Get system properties
final String username = "vedijitendra";
final String password = "sendmail";
props.put("socksProxyHost", "pc-2");
props.put("socksProxyPort", "1080");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.user", username);
props.put("mail.smtp.auth","true"); // this is imp for authorisation.
//props.put("mail.host", "192.168.0.1");
props.put("mail.debug", "true");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
try{
//here the authorisation takes place using an Anonymous class.
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator (){
protected
javax.mail.PasswordAuthentication
getPasswordAuthentication() {
return new
javax.mail.PasswordAuthentication(username,
password);
// Define message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));
message.addRecipient( Message.RecipientType.TO, new
InternetAddress("[email protected]"));
message.setSubject("Test");
message.setContent("text", "text/html");
// Send the message
Transport.send(message);
msg = "The mail has been sent.";
} catch(Exception e){
e.printStackTrace();
msg = "The mail has not been sent.";
I am able to connect to the GMail's SMTP server.
However, when the Transport. send method is executed, I get:
java.lang.NullPointerException
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:242)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1191)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:348)
at javax.mail.Service.connect(Service.java:297)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
Any ideas? -
Error while sending mail through SMTP
Hi,
We are getting the following error while trying to send mail through SMTP.
'554 ERROR_MESSAGE_STATE: SMTP_NO_HANDLER( host:1-,subrc:0001)'
Please advice,
Regards,
SamHi All,
Configured SMTP as per the note 455140,i can able to send mails from SAP to the out side world,
mails in SAP.When i tried the test to check whether the SAP system is correctly set up to receive e-mails as per the note 607108, iam getting a connection closed message as below.
afgdev:pgdadm> telnet afgdev 2500
Trying...
Connected to afgdev.
Escape character is '^]'.
220 afgdev.abc.ae SAP 6.40(52) ESMTP service ready
helo afgdev
250 afgdev.abc.ae
mail from:<[email protected]>
250 Ok
rcpt to:<[email protected]>
250 Ok
data
354 Enter mail, end with "."
Hello,This is a test.
Connection closed.
afgdev:pgdadm>
rgds
Sam -
Uncaught Exception occured while sending mail through abap code.
Hi,
Uncaught Exception occured while sending mail through abap code.Run time Errors "UNCAUGHT_EXCEPTION" occured after excuting the call method CALL METHOD SEND_REQUEST->SEND( ).kindly help in resolving the issue.HI,
Runtime Error: UNCAUGHT_EXCEPTION details.
Runtime Errors UNCAUGHT_EXCEPTION
Exception CX_ADDRESS_BCS
Short text
An exception occurred that was not caught.
What happened?
The exception 'CX_ADDRESS_BCS' was raised, but it was not caught anywhere along
the call hierarchy.
Since exceptions represent error situations and this error was not
adequately responded to, the running ABAP program 'SAPLZSEND_MAIL' has to be
terminated.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_ADDRESS_BCS', was not caught in
procedure "SEND_MAIL" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
An exception occurred
How to correct the error
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"UNCAUGHT_EXCEPTION" "CX_ADDRESS_BCS"
"SAPLZSEND_MAIL" or "LZSEND_MAILU01"
"ZSEND_EMAIL"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
The exception must either be prevented, caught within proedure
"SEND_MAIL" "(FORM)", or its possible occurrence must be declared in the
RAISING clause of the procedure.
Please help me to resolve this issue. -
I am not able to send mails through Yahoo APP. It gives me an error msg :"the sender address has ben rejected by the server ".
I tried adding username and password in the SMTP server settings,But those optiopns are greyed out.
So, i am not able to enter anything in fields under SMTP server settingsYou probably have changing settings disabled in Restrictions.
-
Error: in sending mail through dynamics actions
Hi Friends,
I have a problem in sending mail through dynamics actions . In this we pass a subroutine in dynamics actions which send an mail when promotion action occured.
Problem is that sometimes it will send an mail or sometimes not. I have no idea to solve this problem.
Can anyone suggest me .
Thanks ,
Anish
Moderator message : Duplicate post locked. Continue with thread [send mail through dynamic actions|send mail through dynamic actions].
Edited by: Vinod Kumar on Sep 5, 2011 10:19 AMthis is where i created the keystore.jks file
I navigated to the location C:\Program Files\Java\jdk1.6.0_13\bin in command prompt and typed the following command to create the keystore
keytool -import -trustcacerts -alias root -file mail_test_com.crt -keystore keystore.jksI was asked to set the password for keystore and then i was asked the question "Trust this certificate? [no]:" for which i gave yes.
If this is not the right place to create the keystore.jks can you please tell me what is correct location to create the keystore file. -
Sending mail through "local" mail server?
I've set up fetchmail and procmail to download (and delete) mail from my mail host to a ~/Maildir on a server in my home which I then access through dovecot IMAP.
I want to be able to send mail "through" my server too, instead of going straight to my host's smtp. Maybe there isn't any good reason to do this? I want my Sent mail to be stored on my local server. And if set up more than one mail account, it would have to use the right smtp depending on the email address.
Anyone know how they would go about it? I found a handful of dovecot/fetchmail articles, but none that mention sending mail really. There's an oldish looking wiki article on exim, but I feel like I shouldn't need to use system wide conf for this.Dovecot and fetchmail only handle the mail coming to you (ie, IMAP/POP3). You need SMTP to send email.
I highly recommend Postfix, and set it up to use your ISP's mail server as relay_host -
Cannot send mail through Hotmail on iPad
Cannot send mail through Hotmail on iPad, it's ok through bigpond though. I have tried deleting account and shutdowns x 2 but still nothing.
The message which appears is telling me the user name or password "SMTP: @[email protected]" is incorrect.
Thanks, RonYahoo's been having persistently random issues for months. You can try just waiting it out, or delete and readd your yahoo account. When my accounts were affected I just used webmail to access my yahoo accounts until it cleared up.
Chances are it's all on their end and really all you can do is wait it out.
Maybe you are looking for
-
Hi Expers, How to know from which Fields in R/3, data is coming to the infoobjets in BW. Thanks in Advance. Krishna.
-
I am having scanning problems, as the unit displays 'No Scan Options. Refer to Documentation to trouble shoot!
-
Transfer Vendor Balance to SGL
Dear All I have a Vendor with Credit Balance of 100,000. Can I transfer 20,000 to SGL Account. So that his account is showing 80,000 as credit and 20,000 is shown in the SGL Account. What is the process/t-code? Please advice. Thanks & Regards Kanwalj
-
Integrated Document Management System
Hi, We are considering Oracle IFS as part of an Integrated Document Management system with the following functionality: 1. Document/Image Capture 2. Document Storage & Retrieval 3. Processflow/Workflow IFS meets the requirement for the point 2 above.
-
How to move existing Contact entity attachments to MS SharePoint library
Hi All, We are migrating a MS CRM 4.0 system to MS CRM 2013. One of the change to be implemented is - Move existing Contact entity (and also other entities) attachments to SharePoint 2010 library. Is there any support / feature in MS CRM 2013 to move