473,394 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Send mail from procedure

2
Hi,

I am using utl_smtp.open_data for sending mail from a procedure..But when the no. of persons in to_list exceeds 40 the to_list is displayed in mail_body instead of header.Please help me to solve this.
Jun 19 '07 #1
2 1865
debasisdas
8,127 Expert 4TB
can u please post the code ,for verification.
Jun 19 '07 #2
Gifty
2
CREATE OR REPLACE PACKAGE BODY Mail_Pkg
AS
g_crlf CHAR(2) DEFAULT CHR(13)||CHR(10);
g_mail_conn utl_smtp.connection;
g_mailhost VARCHAR2(255) := 'smtp.honeywell.com';
FUNCTION address_email( p_string IN VARCHAR2,
p_recipients IN ARRAY1 ) RETURN VARCHAR2
IS
l_recipients LONG;
BEGIN
FOR i IN 1 .. p_recipients.COUNT
LOOP
IF (p_recipients(i) IS NOT NULL) THEN
utl_smtp.rcpt(g_mail_conn, p_recipients(i) );
IF ( l_recipients IS NULL )
THEN
l_recipients := p_string || p_recipients(i) ;
ELSE
l_recipients := l_recipients || ', ' || p_recipients(i);
END IF;
END IF;
END LOOP;
RETURN l_recipients;
END;
PROCEDURE send( p_sender_email IN VARCHAR2,
p_from IN VARCHAR2 DEFAULT NULL,
p_to IN ARRAY1 ,
p_cc IN ARRAY1 ,
p_bcc IN ARRAY1 ,
p_subject IN VARCHAR2 ,
p_body IN CLOB DEFAULT NULL )
IS
l_to_list LONG;
l_cc_list LONG;
l_bcc_list LONG;
l_date VARCHAR2(255) DEFAULT TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' );
v_to1 ARRAY1;
PROCEDURE writeData( p_text IN VARCHAR2 )
AS
BEGIN
IF ( p_text IS NOT NULL )
THEN
utl_smtp.write_data( g_mail_conn, p_text || g_crlf );
END IF;
END;
BEGIN
g_mail_conn := utl_smtp.open_connection(g_mailhost, 25);
utl_smtp.helo(g_mail_conn, g_mailhost);
utl_smtp.Mail(g_mail_conn, p_sender_email);
l_to_list := address_email( 'To: ', p_to );
l_cc_list := address_email( 'Cc: ', p_cc );
l_bcc_list := address_email( 'Bcc: ', p_bcc );
utl_smtp.open_data(g_mail_conn );
writeData('MIME-Version: 1.0' ||CHR(13)|| CHR(10)||'Content-Type: text/html' );
writeData( 'Date: ' || l_date );
writeData( 'From: ' || NVL( p_from, p_sender_email ) );
writeData( 'Subject: ' || NVL( p_subject, '(no subject)' ) );
writeData( l_to_list);
writeData( l_cc_list );
utl_smtp.write_data( g_mail_conn, '' || g_crlf );

utl_smtp.write_data(g_mail_conn, p_body );

utl_smtp.close_data(g_mail_conn );
utl_smtp.quit(g_mail_conn);
END;

END;


i am callin send function from outside..in v_to i am sending id of 40 users
Jun 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: lhansen | last post by:
I have a SQL Server 2000 application that send's e-mail to users using the xp_smtp_sendmail procedure. That works fine. What I would like to do is RECIEVE e-mail with SQL Server. Example: I...
2
by: Larisa | last post by:
Hello everyone, I need advice of how to accomplish the following: Loop though records in a table and send an email per record. Email recipient, message text and attachment file name - that's...
11
by: Tim Smallwood | last post by:
Hi, I have an Access project that I use to allow a client to hit an SQL server at my host. This project has several forms that are used to udpate tables, etc, but I'd also like to be able to...
3
by: Patrick | last post by:
Hi Can anyone tell me how can I send email through stored procedure in sql server ? I want to send attachment with this email too. TIA
4
by: Morten Snedker | last post by:
Using the procedure below on an ordinary form works fine. Moving it to a service-project makes it fail on SmtpMail.Send(mail) with error: "Could not access 'CDO Message' object." Google-search...
14
by: Mattia | last post by:
I have a very big problem. I must send a single mail to multiple receivers. The number of receivers are very big: approximately 6000 users, but this number increase each year. I find a lot of...
5
by: Sean | last post by:
Hi... I want to use the macro/sendobject (or any other procedure) to send the contents of a table (very small, ~5 rows/columns) as an Outlook message body, not as an attachment. Access 2000 will...
2
by: saiprasanthi | last post by:
Hi, Can you please tell what is the procedure in SQL Server 2000 to automatically send an email to the customer. I know that we can do it in DTS Packages. But what should be the code in the...
3
by: sachin shah | last post by:
hi all my query is how can i send mail by using sql server, i think by unsing xp_sendmail store procedure we can do this but my problem is what paramater to be pass to this store procedure if i...
5
by: Sekkappan | last post by:
hi, I am new to javamail.now i urgently want a code to send a mail through java program.i am using struts application. can any one explain me clearly about procedure to send to using java...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.