Last post May 17, 2019 02:58 PM by duyrua
May 15, 2019 05:49 PM|Majid Abu Rmelah|LINK
I have a table of users in my database. Each time the user logs in, a column that is called "UserActivity" type DATETIME is updated in the table to the current date that the user logged in. Now, what I want is, if the user did not log in for 15 days
(half a month), he would receive an Email informing him to be active on the website.
I asked this question before on this board, but the thing is that I wanted to send an email using phpMyAdmin which, after searching, is not possible in my case. I saw that I can use Windows Service or Quartz or Task Scheduler in order to achieve what I want.
But unfortunately, I have no idea of using them.
Thank you for reading.
Majid Abu Rmelah.
May 16, 2019 06:25 AM|Yongqing Yu|LINK
Hi Majid Abu Rmelah,
Based on your question, I recommend that you use Task Scheduler for operation.
You can first create an exe program, which writes the logical information you need to execute the email: read the table in the database that records user login information, and then read the date of the "User Activity" column to compare with the current date,
to see if it has not logged in for more than 15 days, and if it exceeds, send the email.
Step 1: Search locally on your computer and open the Task Scheduler software.
Step 2: Select Create Basic Task in the right column.
Step 3: Create your Task Schedule name and description, and click Next.
Step 4: Select how often you want to execute Task in Trigger and click Next.
Step 5: Depending on the frequency of your choice, fill in more detailed information.For example, you choose Daily.,then you need to determine if it is executed from the current moment, and every few days, click Next.
Step 6: Choose a form of task you need to perform. You could choose the first Start a program and click Next.
Step 7: Click Browse, select the location of your exe file, add parameters and set the folder for program/script startup if necessary, and click Next.
Step 8: Check all the information you filled in before, click Finish, and you will create your Task Schedule successfully and start it.
You can also refer to this link: https://docs.microsoft.com/en-us/windows/desktop/taskschd/daily-trigger-example--scripting-
May 16, 2019 10:32 AM|Majid Abu Rmelah|LINK
Hello Yongqing Yu,
Thank you for putting the time and effort to help me with this, I really appreciate that.
I did exactly what you told me to do and I have created my task successfully.
In step 7, I have chosen a .cs file from my website folder that has the code to check the activity of the user and send the mail if 15 days passed.
I would like to ask, when the Task Scheduler runs the basic task again daily, would it run the code that I have chosen as if I ran it by myself?
Hope to hear from you soon and thank you again.
May 17, 2019 08:24 AM|Yongqing Yu|LINK
Your idea is right, but you could not use the .cs file to run in Task Scheduler.
Because .cs file is just a document with code in it, you need to create an application that can be executed by opening it.
You can refer to this link for more information: https://docs.microsoft.com/en-au/windows/desktop/api/taskschd/ne-taskschd-_task_action_type
Such as .exe application, you could put your code idea into .exe application to run Task Scheduler.
You can refer to this link how to create an exe application:
May 17, 2019 02:05 PM|Majid Abu Rmelah|LINK
Worked absolutely perfect!
I don't how to thank you, You helped me to do something that I thought is impossible to do.
I really appreciate your help, may Allah bless you and jazakallah khair.
May 17, 2019 02:58 PM|duyrua|LINK