Home » RDBMS Server » Server Administration » Sending email from forms 5.0 to Lotus notes
Sending email from forms 5.0 to Lotus notes [message #370436] Fri, 24 September 1999 09:56 Go to next message
Vijay
Messages: 116
Registered: September 1999
Senior Member
Can anyone tell me how to send an email from Forms 5.0 to Lotus notes. This would be helpful for me to build my application.

Thanks.
Re: Sending email from forms 5.0 to Lotus notes [message #370438 is a reply to message #370436] Fri, 24 September 1999 10:54 Go to previous messageGo to next message
m a sivan
Messages: 34
Registered: July 1999
Member
I dont really know how to send the mail thru forms specifically but from the backend I think U can do that using the SMTP enlcosed is the code below. try this .
Mey be this can soleve ur problem with Lotus notes also....

u can but u have to have an smtp client with U ...
and also the code is reproduced below but thanks to THOMAS KYTE. he is an ORACLE guru ...

create sequence mail_sira;

create public synonym mail_sira for mail.mail_sira;
grant all on mail_sira to public;

create table sendmail_body(
sira number,
satir number,
katar varchar2(2000));

create public synonym sendmail_body for mail.sendmail_body;
grant all on sendmail_body to public;

grant execute on utl_file to mail;
--utl_file_dir = c:\mail
create or replace procedure sendmail(
phost varchar2,
psender varchar2,
psubject varchar2,
pmail# number,
pto_list varchar2,
pcc_list varchar2,
pattach_list varchar2) is
cursor c is
select katar from sendmail_body
where sira=pmail#
order by satir;
pfile utl_file.file_type;
params varchar2(2000);
dummy varchar2(20);
ok boolean:=false;
ploop number:=0;
plock# number;
ndumm number;
dizi dbms_utility.uncl_array;
dizi_sayac number;
procedure c_to_t(list IN VARCHAR2,tablen OUT number,tab OUT dbms_utility.uncl_array) is
dummy varchar2(2000);
ara varchar2(2000);
sayac number;
begin
sayac:=0;
dummy:=list;
loop
if nvl(length(dummy),0)0 then
sayac:=sayac+1;
if instr(dummy,',')=0 then
tab(sayac):=dummy;
exit;
else
tab(sayac):=substr(dummy,1,instr(dummy,',')-1);
dummy:=substr(dummy,instr(dummy,',')+1,length(dummy)-instr(dummy,','));
end if;
else
exit;
end if;
end loop;
tablen:=sayac;
end;
begin
params:='c:\mail\smtpsend.exe ';
if phost is null then
raise_application_error(-20001,'Host name can not be null');
else
params:=params || '-h' || phost || ' ';
end if;
if psender is null then
params:=params || '-f' || 'NoName@NoWhere.com' || ' ';
else
params:=params || '-f' || psender || ' ';
end if;
if psubject is null then
params:=params || '-s' || 'No Subject' || ' ';
else
params:=params || '-s' || psubject || ' ';
end if;
if pmail# is null then
raise_application_error(-20002,'Mail # can not be null');
end if;
if pto_list is null then
raise_application_error(-20003,'To list can not be null');
else
if instr(pto_list,',')=0 then
params:=params || '-t' || pto_list || ' ';
else
c_to_t(pto_list,dizi_sayac,dizi);
for i in 1..dizi_sayac loop
params:=params || '-t' || dizi(i) || ' ';
end loop;
end if;
end if;
if pattach_list is not null then
if instr(pattach_list,',')=0 then
params:=params || '-a' || pattach_list || ' ';
else
c_to_t(pattach_list,dizi_sayac,dizi);
for i in 1..dizi_sayac loop
params:=params || '-a' || dizi(i) || ' ';
end loop;
end if;
end if;
if pcc_list is not null then
if instr(pcc_list,',')=0 then
params:=params || '-c' || pcc_list || ' ';
else
c_to_t(pcc_list,dizi_sayac,dizi);
for i in 1..dizi_sayac loop
params:=params || '-c' || dizi(i) || ' ';
end loop;
end if;
end if;
params:=params || '-ic:\mail\sendmail.body ';
params:=rtrim(params);
select lock#.nextval into plock# from dual;
loop
select count(*)
into ndumm
from v$session
where to_number(substr(client_info,instr(client_info,'-')+1)) client_info is not null;
pfile:=utl_file.fopen('c:\mail\','shell.ok','r');
utl_file.get_line(pfile,dummy);
utl_file.fclose(pfile);
if substr(dummy,1,1)='O' and ndumm=0 then
pfile:=utl_file.fopen('c:\mail\','shell.ok','w');
utl_file.put_line(pfile,to_char(plock#));
utl_file.fclose(pfile);
ok:=true;
else
ploop:=ploop+1;
if ploop > 100 then
raise_application_error(-20000,'Try again later');
else
dbms_application_info.set_client_info('Waiting for ' || to_char(ploop) || ' secs - ' || to_char(plock#));
dbms_lock.sleep(ploop);
dbms_application_info.set_client_info(null);
end if;
end if;
exit when ok;
end loop;
pfile:=utl_file.fopen('c:\mail\','shell.ok','r');
utl_file.get_line(pfile,dummy);
utl_file.fclose(pfile);
if plock#to_number(dummy) then
raise_application_error(-20999,'Conflict ! Try again');
end if;
pfile:=utl_file.fopen('c:\mail','sendmail.body','w');
for i in c loop
utl_file.put_line(pfile,i.katar);
end loop;
-- utl_file.put_line(pfile,' ');
-- utl_file.put_line(pfile,' ');
-- utl_file.put_line(pfile,'Posted via SeMaFOr (SEnd MAil From ORacle)');
-- utl_file.put_line(pfile,'SeMaFOr is designed by Hakan Yuksel (HakanY@banKapital.com.tr)');
utl_file.put_line(pfile,' ');
utl_file.fclose(pfile);
shell(params,false);
end;
/
create public synonym sendmail for mail.sendmail;
grant all on sendmail to public;

--test
execute shell('plus80',true,true);
execute sendmail('Host',null,null,0,'hakany@bankapital.com.tr',null,null);
--/test

Do let me know if it works , I have not tested..
Re: Sending email from forms 5.0 to Lotus notes [message #370439 is a reply to message #370438] Fri, 24 September 1999 11:03 Go to previous messageGo to next message
Vijay
Messages: 116
Registered: September 1999
Senior Member
Thanks Sivan for the solution. I'll try this and let you know for sure.

Vijay.
Re: Sending email from forms 5.0 to Lotus notes [message #370440 is a reply to message #370439] Fri, 24 September 1999 11:13 Go to previous message
m a sivan
Messages: 34
Registered: July 1999
Member
Yeah please try this and let all know and THANK thomas kyte for this. I have not done anything for this.

Sivan.
Previous Topic: inserting rows into a table
Next Topic: Date comparing in decode statement
Goto Forum:
  


Current Time: Thu Mar 28 18:56:08 CDT 2024