Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
send mail automatically after 24 hours.
Posted
Updated 24-Mar-11 1:58am
v2
Comments
Sandeep Mewara 24-Mar-11 9:59am    
Lazy. No effort in trying it nor in writing question.

You can do this by your DataBase try this code.

You need SSIS to call a stored procedure every period of time.

Please check this for the stored procedure (I got it from here: http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_21944312.html):

SQL
CREATE   PROCEDURE [dbo].[PROC_CDOMAILALERTS]
      @From varchar(200),
         @To varchar(200),
         @ReplyTo varchar(200),      
         @Cc varchar(200),
      @ArchiveId varchar(200),
      @SMTPServer varchar(100),
         @Subject varchar(200) = " ",
         @Body varchar(4000) = " "
         AS
BEGIN
         Declare @iMsg int
         Declare @hr int
        Declare @ht int
         Declare @source varchar(255)
         Declare @description varchar(500)
         Declare @output varchar(1000)
      
      --********************************************************************
      --Set the ids to which Bcc should be sent
      Set @ArchiveId = @ReplyTo + ',' + @ArchiveId

      --************* Create the CDO.Message Object ************************
         EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT


      --***************Configuring the Message Object ******************
      -- This is to configure the Remote Server Name or IP address.
      -- Replace MailServerName by the name or IP of your SMTP Server.
         EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
         EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', @SMTPServer

      -- Save the configurations to the message object.
         EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

      -- Set the e-mail parameters.
         EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
         EXEC @hr = sp_OASetProperty @iMsg, 'ReplyTo', @ReplyTo
         EXEC @hr = sp_OASetProperty @iMsg, 'Cc', @Cc
         EXEC @hr = sp_OASetProperty @iMsg, 'BCc', @ArchiveId
         EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
         EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

      -- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
         EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
         EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL
         EXEC @ht = sp_OADestroy @iMsg
        RETURN @hr

      
END


link [^]
 
Share this answer
 
v2
Hope this[^] might help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900