I want to send user the reminder email automatically without any trigger if a table returns a value on that specific date.
how to do that?
This my code which determines if there is any task on the calendar or not
<WebMethod()> _
<Script.Services.ScriptMethod(ResponseFormat:=Script.Services.ResponseFormat.Json)> _
Public Function UpcomingTasks() As String
Return GetJson(DB.GetData("select created, title, description, alerttype, convert(varchar, alerttime, 100) alerttime from reminder where alertfor = @uid and convert(date, alerttime) = CONVERT (date, GETDATE()) and deleted = 0 and dismissed = 0 order by alerttime", DB.SIP("uid", LocalHelper.UserID())))
End Function
if there is any task for each task i want to send separate reminder email
this is my code for sending reminder email
Public Sub SendCalender(reminder As Reminder)
Dim calFile As String
' create file name, e.g. [Reminder]-[reminderId]-[createdbyid].ics
calFile = String.Format("{0}-{1}-{2}.ics", "Reminder", reminder.Id, reminder.CreatedBy)
' Create a blank file ready for writing
Dim w As System.IO.StreamWriter = System.IO.File.CreateText(HttpContext.Current.Server.MapPath("~/uploads/cal/" & calFile))
w.Write(GenerateCalFile(reminder))
w.Close()
Dim _email As New Email()
With _email
' send out invitations
Dim sTo As String = New User(reminder.AlertFor).Email
Dim sCC As String = New User(reminder.CreatedBy).Email
.MailTo = sTo
.MailCC = sCC
.MailFrom = sCC
.Subject = String.Format("{0} on {1}", reminder.Title, reminder.AlertTime.ToString())
.Attachments = HttpContext.Current.Server.MapPath("~/uploads/cal/" & calFile)
.Body = reminder.Description
.Send()
End With
End Sub
how shall i compare the value and call the send email function
Aucun commentaire:
Enregistrer un commentaire