I have just finished writing an email alert system in VS2005 using VB.NET. It has three fields:
USERNAME
EMAIL
EVENTYPE
ISACTIVE
They can configure their settings on a client aspx page. They can also opt out.
Now I want to create a Windows application in the back end that does this:
(A) Sends an email to every user in that table whose Isactive field is set to 1 (yes, send them the email)
(B) In the email body, the program will query ANOTHER table and based on the eventtype will pull al the events where the eventtype equals whatever the user chose.
How hard is this to implement? I know how to use the SQL.WEB.MAIL stuff but I need more code samples. Prefer them to be in VB.NET, but C# is fine too (Frederik any clues?) As far as when they get the email, i'll do it manually meaning i'll launch the application. The code will be on the Form's Load Event, then the program will exit automatically as such:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Do what i have to do here, then exit the app.
Application.Exit()
End Sub
Thanks for all your help ASP.NET users! :)
Best!
AsafUse ADO.Net to get your email form the data source. Do a new query based on the eventtype for each row (if you can't join the tables togheter within the first query).
Get each row from the data retuned from the data source and use the SmtpMail class to send our your e-mails.
I should probably used a Windows Service instead of an Windows Application. A Windows Application will be closed when you are logged out from the computer, but a service will still run.
0 comments:
Post a Comment