how to send mail to lotus notes with attachment from oracle forms [message #493313] |
Mon, 07 February 2011 05:11 |
|
JAGLAN
Messages: 20 Registered: December 2010 Location: Noida
|
Junior Member |
|
|
Hi All
A warm Greeting to all of you,
Query :"how to send mail to lotus notes with attachment from oracle forms"???
I am in middle of something and i just stuck...Please help me..what procedure i should follow to run it successfully.
Regards,
Saurabh Jaglan
|
|
|
Re: how to send mail to lotus notes with attachment from oracle forms [message #493357 is a reply to message #493313] |
Mon, 07 February 2011 07:37 |
gopalsaw
Messages: 3 Registered: November 2010 Location: Jamshedpur
|
Junior Member |
|
|
you can write a procedure and funcion to send the mail I attached a function how to send the
create or replace procedure send_mail is
-- ln_count1 NUMBER := 0;
ln_track NUMBER := 0;
crlf VARCHAR2(2) := UTL_TCP.CRLF;
connection utl_smtp.connection;
mailhost VARCHAR2(30) := 'server ip add';
sender varchar2(50);
recipient varchar2(50);
ccrecipient VARCHAR2(50);
subject varchar2(100) := 'Track Create Report as on' || to_char(sysdate,'dd-Mon-yyyy');
message VARCHAR2(2000) := ' Track Create Report as on ' || to_char(sysdate,'dd-Mon-yyyy');
header VARCHAR2(1000);
cursor cvar_mail_list is
select * from v_mailing_list where mal_prog_id = 'TRACK';
begin
BEGIN
for mvar_mail_list in cvar_mail_list loop
connection := utl_smtp.open_connection('server ip add',port);
recipient := mvar_mail_list.MAL_RECPT1;
ccrecipient := mvar_mail_list.MAL_RECPT2;
sender := 'email add';
header := 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS') || crlf ||
'From: ' || sender || '' || crlf || 'Subject: ' || subject || crlf ||
'To: ' || recipient || crlf || 'CC: ' || ccrecipient || crlf;
utl_smtp.helo(connection, mailhost);
utl_smtp.mail(connection, 'email@yahoo.com');
utl_smtp.rcpt(connection, recipient);
utl_smtp.rcpt(connection, ccrecipient);
--- utl_smtp.rcpt(connection, 'email@yahoo.com');
utl_smtp.open_data(connection);
utl_smtp.write_data(connection, header);
utl_smtp.write_data(connection, crlf || message);
utl_smtp.write_data(connection, crlf || ' ' ||crlf );
utl_smtp.write_data( connection,
' ' ||
'This is test mail'
);
-------------------------------------------------------------------------------------------------
BEGIN
SELECT count(*)
INTO ln_track
FROM track
where p_no = 112288;
exception
when others then
ln_track := 0;
end;
utl_smtp.write_data( connection,
'Total Track for 112288 ' ||
ln_track
);
------------------------------------------------------------------------------------------
utl_smtp.write_data(connection,
crlf ||
'Note : This is a machine generated message, Pls. do not reply to this mail.');
utl_smtp.close_data(connection);
utl_smtp.quit(connection);
end loop;
EXCEPTION
WHEN UTL_SMTP.INVALID_OPERATION THEN
dbms_output.put_line(' Invalid Operation in SMTP transaction.');
WHEN UTL_SMTP.TRANSIENT_ERROR THEN
dbms_output.put_line(' Temporary problems with sending email - try again later.');
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Errors in code for SMTP transaction.');
END;
end send_mail;
change all field and condiotn and servername of your company
|
|
|
|