Procedure to send an email to a customer using procedures in SQL Server 2000

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saiprasanthi
    New Member
    • Oct 2006
    • 7

    Procedure to send an email to a customer using procedures in SQL Server 2000

    Hi,

    Can you please tell what is the procedure in SQL Server 2000 to automatically send an email to the customer. I know that we can do it in DTS Packages. But what should be the code in the procedure to send a mail.

    I've a code in the following link but I'm afraid its giving some errors. Kindly check the link



    I'll be very thankful if someone could really help me out.

    Thanks in advance.
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    To send an e-mail from SQL server you have to have Microsoft Outlook or
    other e-mail service installed on your server.
    Also it should have generic mail account on it.
    Due to security reasons it is not allowed to have an e-mail service on a server in my company so see what I do instead to send an email to msql_dba team through some_e_mail.exe that is standard built in my company. You can run any exe from xp_cmdshell with parameters the same way as you do from command prompt. Hope it will help you somehow.

    [PHP]Declare @msg varchar(1000)
    BEGIN
    RAISERROR ('The replication latency is too high please investigate',16 , 1)
    select @msg = 'c:\PROGRA~1\au toproxy\ some_e_mail btell -mail msql_dba "Replicatio n Latency on server: ' +@@servername + ' Hrs '+rtrim(cast(@h as char))+' Min '+ rtrim(cast(@m as char))+'"'
    exec master..xp_cmds hell @msg
    END[/PHP]

    Comment

    • AricC
      Recognized Expert Top Contributor
      • Oct 2006
      • 1885

      #3
      Why don't you send the email via PHP or another scripting language?

      Comment

      Working...