By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

"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

P: n/a
Thank you very much, that's exactly what I've been looking for

Larisa

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.