本文介绍了24小时后自动发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
24小时后自动发送邮件.
send mail automatically after 24 hours.
推荐答案您可以通过数据库尝试此代码. 您需要SSIS每隔一段时间调用存储过程. 请检查此存储过程(我从这里获得了它:www.experts-exchange/Microsoft/Development/MS-SQL-Server/Q_21944312.html): 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: www.experts-exchange/Microsoft/Development/MS-SQL-Server/Q_21944312.html): 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("schemas.microsoft/cdo/configuration/sendusing").Value','2' EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields("schemas.microsoft/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 [^]
希望此 [ ^ ]可能会为您提供帮助. Hope this[^] might help you.
更多推荐
24小时后自动发送邮件
发布评论