need a big help-how to send an eamil from mail lis

  • need help

    how to send a mail list from sql server

    from tbale usrs

    like this

    -------------------------------------

    SELECT Email FROM dbo.users

    -------------------------------------------

    and get this!!!

    ----------------------------------

    and get result

    -----------------------------------

    user1@sql.net;user2@sql.net;.........

    ----------------------------------------

    i have a workig code this

    --------------------------------

    exec master.dbo.xp_SMTPSendMail80

    @recipient='midan1@zahav.net.il',

    @query='SELECT * FROM [mira].[dbo].[UserBirthDay] WHERE (BirthdayToday = 1) ',

    @address='out.zahav.net.il',

    @subject='Subject Line',

    @from='midan1@zahav.net.il',

    @html=1, -- Send the results as html

    @Body='<html><header>header</header><body>Body Text</html></body>',

    @qTableCaption='This is a Caption',

    @qTableAttribute='border=2'

    ----------------------------------

    how can i use instead of this (email TO)

    --------------------------------]

    @recipient='midan1@zahav.net.il',

    ------------------------------------

    make a SELECT Email FROM dbo.users

    and send a mail list

    ------------------

    thnks ilan

  • Ilan,

    I think what you want to do it to create a single variable with a list of users and then set that as @recipients.

    Try this:

    declare @recipient varchar(1000)

    set @recipient = ''

    select @recipient = @recipient +

    case

    when @recipient > '' then ';'

    else ''

    end

    + EMAIL

    from dbo.users

    print @recipients

    This will create a single string of users delimited with ;

    Jeremy

  • can you to show put all together

    i get this error

    ---------------

    The minimum parameters are Recipient, From and Address. All must be supplied.

    Quick format -

    --------------

    what is the problem ???

    ilan

    Edited by - midan1 on 07/24/2003 08:25:59 AM

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply