Tuesday, March 27, 2012

Auto email

Hi All,
I want to write a console application to send email. There is a Date field in the SQL Server and I need to send email 2 weeks before that date.I have no idea how to write a console application and make it work.Does anybody have code for this? If so please post it.
Thanks a lot,
Kumar.Easier might be just to create a stored procedure, and then schedule that via DTS on the SQL Server itself.Addition: You can use SQL Mail and do all mailing inside SQL Server.

Otherwise, search Google for "SMTP VB.NET" you will get thousands of links, including this:

http://www.codeproject.com/vb/net/epsendmail.asp|||Also you can either:

1) create a job in sql server that fetches the relevant rows
and sends emails

2) create a webservice that selects rows from the database
and create some vbs file that pings web service via http (XmlHttp)
and schedule this vbs in windows scheduler to run each day at night

No comments:

Post a Comment