Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-03-31 : 07:23:16
|
| chad writes "I have a table the contains a password expiration record for every user. The table also contains each user's email address. Is there a way to send emails to each user whose password expiration date is 14 days or less away. A job runs every night to populate the table. The emails would need to be sent once per day to each user whose password is set to expire within 14 days or less until there password is changed and not set to expire for another 30 days. The user then would not receive an email concerning there password expiration until password expiration date was within 14 days or less. Any suggestions and/or solution would be greatly appreciated" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2003-03-31 : 07:46:27
|
| Perform a "Forum search" for "mail queue" (and variations in these words). There have been several well written articles posted here on this topic....mainly by Robvolk and Merkin |
 |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2003-03-31 : 07:50:02
|
| You can use the sample query below to select the receipts as semi-colon seperated values and send Mails using xp_sendmail.Refer BOL on xp_sendmail for more details..Hope this helps..declare @sqlstr varchar(8000)set @sqlStr = ''select @sqlStr = @SqlStr + ';' + FirstName from Northwind.dbo.Employees where datediff(d,getdate(),BirthDate)<14Select Stuff(@sqlStr,1,1,'') as RecipientsEXEC xp_sendmail @recipients = @sqlStr, @query = 'SELECT * FROM INFORMATION_SCHEMA.TABLES', @subject = 'SQL Server Report', @message = 'The contents of INFORMATION_SCHEMA.TABLES:'Sekar~~~~Success is not a destination that you ever reach. Success is the quality of your journey. |
 |
|
|
|
|
|