473,396 Members | 2,057 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,396 software developers and data experts.

Best way to send email from a stored procedure (dynamically changing paramenters and attachment)

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 all changes
record by record.

Is it doable from a stored procedure (easily I mean, or am I better off
writing a VB app)? There are so many options of sending mail from SQL
server - CDONTS, SQL MAIL TASK, xp_sendmail. What's easier to implement
and set up?

Thanks a lot!!!(links and fragments of sample code would be greatly
appreciated)
Larisa

Jul 23 '05 #1
2 6404

"Larisa" <la********@hotmail.com> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.com...
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 all changes
record by record.

Is it doable from a stored procedure (easily I mean, or am I better off
writing a VB app)? There are so many options of sending mail from SQL
server - CDONTS, SQL MAIL TASK, xp_sendmail. What's easier to implement
and set up?

Thanks a lot!!!(links and fragments of sample code would be greatly
appreciated)
Larisa


If you have a lot of emails to send and a busy server, you might be better
off to dump the information to a text file, then send the emails from an
external script. This might also be the only option if you need to do
advanced formatting or something else that isn't available with the standard
options.

If you do want to use a stored procedure, then many people prefer
xp_smtp_sendmail to xp_sendmail/SQL Mail, because you don't need to install
Outlook or whatever on your server, it's just a single extended proc:

http://www.sqldev.net/xp/xpsmtp.htm

Simon
Jul 23 '05 #2
Thank you very much, that's exactly what I've been looking for

Larisa

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
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
17
by: | last post by:
I have an app that retrieves data from an Access database. At the moment I have the SQL string as a Const in my app. I understand this is not best practice. I don't want the user to have access to...
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...
1
by: maflatoun | last post by:
Hi, I have a C# web app that searches my database table using the following search parameters Search string, criteria (< =) and the field you want to perform your search on. My understanding...
2
by: shahnawaz shaikh | last post by:
hi friends i want to send email thoruth stored procedure or i want to give functionality like alert which is send email automaticaly from database. just like a news or any ad email weekly or...
1
by: julienzz | last post by:
I can't really know what's wrong with my code, plz I need help, thx the Words underlined here, r underlined in Delphi(error) unit mailer; interface uses Windows, Messages, SysUtils,...
3
by: Darkside12 | last post by:
Hi, I'm trying to build a dynamic query by form. The idea is that a user can select a table in the database via a combo box and this will then change all of the text box labels on the form to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.