"Larisa" <larisa1970@hotmail.com> wrote in message
news:1105395792.363855.6060@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