How to generate email from database( MS SQL SERVER 2000 or 2005)

  • Hi All,

    I want to generate an email from my database. I have tried it lot of time by reading a lot of forums. But I still unable to generate the email....

    I want to generate the email by using windows authentication......

    Please help me and tell me the requirement to generate the email from database.

    Thanks in advance.

  • Kailash Mishra (4/6/2009)


    Hi All,

    I want to generate an email from my database. I have tried it lot of time by reading a lot of forums. But I still unable to generate the email....

    I want to generate the email by using windows authentication......

    Please help me and tell me the requirement to generate the email from database.

    Thanks in advance.

    Are you trying to set up Database mail here? What problem you have? how did you confirm that its not working?

  • Have you tried using the xp_smtp_sendmail in master? If not i'll send you an example;-)

  • ksparke (4/6/2009)


    Have you tried using the xp_smtp_sendmail in master? If not i'll send you an example;-)

    Nope

  • Check master DB for the XP_SMTP_SENDMAIL extended stored proc or download xpsmtp80.dll and add it as an extended stored proc

    Create the proc below and send it @TO,@CC,@Subject,@Message

    Make sure the @server variable is set to the mail server I.P

    Create procedure sp_mail

    @TO varchar(8000),

    @cc varchar(8000),

    @Subject varchar(500),

    @Message varchar(8000)

    as

    declare @rc int

    exec @rc = master.dbo.xp_smtp_sendmail

    @FROM = N' ', --Your email add

    @FROM_NAME = N' ', --Add name to address

    @replyto = N'',

    @TO = @TO,

    @cc = @cc,

    @BCC = N'',

    @priority = N'NORMAL',

    @subject =@Subject,

    @type = N'text/plain',

    @message =@Message,

    @messagefile= N'',

    @attachment = N'',

    @attachments= N'',

    @codepage = 0,

    @timeout = 10000,

    @server = ' ' --add mail server i.p here

  • Thanks all,

    I downloaded the XPSMTP80.DLL and added it in database. Now I able to generate the mail.

    But I think that the dll file XPSMTP80 was made by some person with the scripting, which I downloaded from the http://www.sqldev.net.

    But I am unable to understand how it works, because we can't see the code....

    Can someone tell me...

    Thanks to all.

Viewing 6 posts - 1 through 5 (of 5 total)

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