Solved

Oracle Report 6i - send mail

Posted on 2007-11-20
4
2,098 Views
Last Modified: 2013-12-19
Dear experts
I have 9i database and Report 6i.
I want to send salary paper on employee's mail.
One paper to one employee, mean payslip only mailed to the related employee.
I have Report of all payslip  and I can save it in rtf format.
What is the suitable solutions?

Best regards
0
Comment
Question by:lamija
  • 2
4 Comments
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 20325719
do you want to send mail from oracle database or from reports 6i ?

if you want to send from oracle database, then you should have a table
where to email address is stored and text you want to send can also be in
CLOB field and also the subject we can have. something like the below :

mail_payslip table
-------------------
to_address varchar2(100),
subject  varchar2(1000),
mail_text clob
process_flag varchar2(1) -- this we can have it Y or N

We can write a pl/sql block, to pick all records ( with process_flag as 'Y') from the above table and send
the text which we have stored in mail_text to the email address which we have given in to_address field along
with the subject.

Thanks
0
 
LVL 47

Expert Comment

by:schwertner
ID: 20326189
Reports server 9i/10g is able to send mails.
You have to think about migration to
newer version of reports.

But if you won't to migrate
you have to write stored procedure and to invoke it
from Reports:

CREATE OR REPLACE PROCEDURE SP_SENDMAIL
(
mail_server in varchar2,
sender in varchar2,
recipient in varchar2,
subject in varchar2,
message in varchar2)
is
c utl_smtp.connection;
mesg varchar2 (4000);
crlf varchar2(2) := chr(13) || chr(10);
mlength number(4);
mdone number(4) := 0;
mpos number(3) :=1;
linewidth number(2) := 60;

begin

mlength:=length(message);

c := utl_smtp.open_connection(mail_server, 25);

utl_smtp.helo(c, mail_server);

utl_smtp.mail(c, sender);

utl_smtp.rcpt(c,recipient);

mesg := 'Date: ' || to_char(sysdate, 'dd Mon yy hh24:mi:ss');
mesg := mesg || crlf;
mesg := mesg || 'From: ' || sender || '<' ||
sender || '>';
mesg := mesg || crlf;
mesg := mesg || 'To: ' || recipient || '<' ||
recipient || '>';
mesg := mesg || crlf;
mesg := mesg || 'Subject: ' || subject;
mesg := mesg || crlf;
mesg := mesg || '' || crlf;

while mdone < mlength and mpos < mlength
loop

if (mlength - mdone) < linewidth then
mesg := mesg || substr(message, mpos, mlength - mdone) || crlf;

mdone := mdone + (mlength - mdone);
mpos := mlength;
else
mesg := mesg || substr(message, mpos, 60) || crlf;
mpos := mpos + 60;
end if;

end loop;


utl_smtp.data(c, mesg);
utl_smtp.quit(c);

exception
when utl_smtp.transient_error or
utl_smtp.permanent_error then
utl_smtp.quit(c);

raise_application_error(-20000, 'Failed to send mail due to following
' || sqlerrm);
end sp_sendmail;



0
 
LVL 1

Author Comment

by:lamija
ID: 20330496
ok
If I choose migration to Report 9i how can I send mail?
0
 
LVL 47

Accepted Solution

by:
schwertner earned 500 total points
ID: 20334142
First at all you have to find a working or install an SMTP mail.server.
After that you have to install Oracle Forms/Reports server standalone
or find working Oracle Application Server 9i/10g with Oracle Forms/Reports server
installation on it.

Now you can either Reports Developer distribution list and to add mailing of reports
after creating or use a batch job that using binaries in the Reports server installation
maiils the report.

It is explained on the documentation of Oracle Forms/Reports server on the OTN.
Build Reports on the WEB sofar as I recall.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

929 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now