[Example] send email from oracle forms using HOST command [message #87120] |
Tue, 07 December 2004 16:31 |
Louis
Messages: 13 Registered: January 2002
|
Junior Member |
|
|
The following sample code explains how to send email through oracle
forms.
The sample code use CmdEmail component to send email, you do not need to
install outlook on your form server.
Requirement: Form server should be
running on windows platform.
Please download the free version of CmdEmail from <A
href=http://www.lv2000.com/sendmail.htm>http://www.lv2000.com/sendmail.htm[/url]
DECLARE
v_file_path varchar2(300);
v_sendmail_exe_path varchar2(300);
text_file text_io.file_type;
BEGIN
v_sendmail_exe_path := 'D:sendmailsendmail.exe' ;--TODO: Change the
path
v_file_path := 'd:emailmsg.txt' ;--TODO:
text_file:=text_io.fopen(v_file_path,'w');
-- write header
text_io.put_line(text_file,'to:louis@lv2000.com');
text_io.put_line(text_file,'cc:abc@defg.com');
text_io.put_line(text_file,'bcc:hij@klmn.com');
text_io.put_line(text_file,'attachment:c:tempfile1.doc');
text_io.put_line(text_file,'attachment:c:tempfile2.xls');
text_io.put_line(text_file,'subject:Merry Christmas');
text_io.put_line(text_file,'delete_the_file:yes');--delete the message file when
the mail is sent successfully.
text_io.put_line(text_file,''); --
delimiter between header and body
-- write body
text_io.put_line(text_file,'first line of the body'||chr(10)||'second
line');
text_io.fclose(text_file);
host(v_sendmail_exe_path||' -m:'||v_file_path,NO_SCREEN);
END ;
|
|
|