Email scheduling in C# (ASP .NET) - c#

Hi want to send birthday emails to all employees which details are stored in database.
I found Quartz .NET library
but can't understand the code exactly.
can anyone please give me some sample code.?

This is the first time I heard about Quartz. It looks cool.
Found this stackoveflow thread How to use Quartz.net with ASP.NET

Further to Ives - answer:
What about from their website:
http://www.quartz-scheduler.org/docs/examples/index.html
This blog maybe of help as well..
http://blog.goyello.com/2009/09/21/how-to-use-quartz-net-in-pro-way/
Stack Overflow Question
Sending Periodic Mail according to user's Setting in ASP.net?

I guess this is something similar here.

You can code a small console application, a simple database with 1 table as you said which keeps dates,names and other details you need.
Simply select all rows which meets condition
Birthday == DateTime.Now
and mail them in a loop.
You can add this exe as a scheduled job with a few clicks and set it to run every day. It would also be a good practice for you.

You can write a script file (possibly in VBScript as a VBS file) and schedule that script file in the Windows Task Scheduler (say every morning 8 AM) on the server level.

Related

Email sending program approach in C#?

Imagine you're creating an email sending program using c# that send a "Welcome" email and a "Come back" email to your customers. The idea is that the application runs every day as a scheduled job. When the run it is printed if it went well or badly. How would you approach this? How would you think the architecture would look? And would you use any special techniques?
Use the MailMessage class to send emails.
Check it out here below:
https://learn.microsoft.com/en-us/dotnet/api/system.net.mail.mailmessage?view=netframework-4.8
You can use either a console or a windows forms project for this. Keep the app open and use the DateTime class to loop through each day.
More about the DateTime class here:
https://www.c-sharpcorner.com/article/learn-about-datetime-in-c-sharp/
You can then use an MS SQL database to serve as your log for this application.
Not sure of you have heard about Hangfire, but I found it quite useful and easy to use to setup recurrent tasks like the one you described.
https://www.hangfire.io/

how to create and run cronjob which delete database files

I have made a application in c# with a RavenDB.
Now i need some assistant at creating a cronjob script which runs like 3 time's a day to delete files in my database older than 15 days.
An easy couple of steps:
Write a *.bat script to do your logic
use Task Scheduler to run the script according to the desired schedule
I have used Quartz.net in the past and that contains a CronTrigger. Very flexible and well documented.
if its an app in asp.net you can call the function in App_Start function of global.aspx page using timer controls which repeat after a certain amount of time.
you can refer to this Url for more details
http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc

How to make a system event application in c#?

I am trying to make the following. I have a class that at midmight it makes a log from what happened in a SQL table and makes an excel file of it. My issue is that I was told that it is inexcusable to have this application running all day only to have it run once a day and that I should do this with a system event, but I have no idea how to do this. Help, please?
The easiest solution is to use Windows' built in Scheduled Task support to run your app. Or, if you're using Microsoft Sql Server, a scheduled Sql Agent job.

Is there a way to print the date that an application was last published?

By using System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion one can identify the publish version of an application in C#.
Is there a way to identify the date when the application was last published? I'd like to add a "Last Updated:" line to my About... dialog.
How about when the app was built?
System.IO.File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location)
See Jeff Atwood's blog. A nice & tricky way

How to make my application as a trial version?

i want to make my application trial version for certain time to used for my customer. so i also have dll file downloaded. then what is the process to make it?
These links may help you
http://www.softwarekey.com/swk_products/trial_creator/
http://www.codeguru.com/forum/showthread.php?t=319168
You need to apply license on your application and you have to store data in your database or in your application related to expiry date.
this thing you require to code.
there are no of example avaiable on google related to licensing your application for given no. of days.

Categories

Resources