Help Put all together and send Email use xp_smtp_s

  • this is a big big help for my

    Help Put all together and send Email use xp_smtp_sendmail

    and send a greeting BirthDay by email !!!

    my request for your help is

    1)

    select from UserBirthDay

    2)

    convert the field EMAIL to mail list

    3)

    send email use xp_smtp_sendmail

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

    1)

    i have a table thet have all the birthday date of all the employee

    this

    ################################

    select FirstName FROM dbo.UserBirthDay WHERE (BirthdayThisWeek = 1)

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

    2)

    i have the code thet can

    convert the Email field to mail list

    like this

    mail1@sql.net ; mail2@sql.net ...........

    this

    ################################

    DECLARE @pstrNames VARCHAR(8000)

    SET @pstrNames = ''

    -- Append all results into a variable

    SELECT @pstrNames = @pstrNames + ISNULL(email, '') + ';'

    FROM dbo.users

    -- Remove the comma at the end

    IF ( RIGHT(@pstrNames, 1) = ',' )

    SET @pstrNames = LEFT(@pstrNames, LEN(@pstrNames) - 1)

    SELECT @pstrNames

    ################################

    3)

    i have the code for send Mail use xp_smtp_sendmail

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

    declare @rc int

    exec @rc = master.dbo.xp_smtp_sendmail

    @FROM = N'mail1@sql.net',

    @TO = N'mail_list@sql.net',

    @server = N'sql.net'

    @subject ='SELECT BirthDay

    FROM dbo.users'

    @message = N'<HTML><H1>This is some HTML content</H1></HTML>',

    @type = N'text/html'

    exec @subject

    select RC = @rc

    go

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

    thnks a lot

    ilan

    Edited by - midan1 on 07/20/2003 12:46:04 AM

    Edited by - midan1 on 07/20/2003 1:28:48 PM

  • This was removed by the editor as SPAM

  • maybe you can take a look at this site

    of the examples

    in the xp_SMTPSendMail80 a new DLL file

    i wont to know how to run a query to email

    from sql server

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

    the url site is

    http://www.thorpesoftware.com/

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

    thnks ilan

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

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