Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Quote:
I have created a web services that do auto emailing from Global.cs. I used the reference Code Project Ref for Simulate WS for auto scheduled email services, and it is sending email every 2 minutes from my gmail account to another gmail account. Now, I want to go further based on this success. I want to have UI interface where user can choose whom to send, what to send, send time, start date and end date in web form and make them work. For this, I have several drop down lists for recipients, course broucher, send time, two calendars for start date and end date in web form.

User can make selectoin on this UI. Then, user can configure to send daily automatic email. I have created a table for ScheduledEmailID(PrimaryKey), Recipient Foreign ID, Email to Send, Send Time(datatype Time(7)), Start Date(datetype DateTime) and End Date(datatype DateTime). I will save user input into MS Sql. Then, I will fectch them to Global.cs, write business logic which is to compate datetime to run auto scheduling.Is it advisable to do it? Any idea, please. I also want to make sure that the service should stop running at End Date. Currently, this 2 minutes interval sending email has no stop option. Please adivse. Thank alot.

I used this article as my point of ref Simulate a Windows Service using ASP.NET to run scheduled jobs[^].
Posted
Comments
Sergey Alexandrovich Kryukov 4-Aug-14 13:29pm    
You can "write codes" by doing all relevant software development work. It's not clear what is your concern. This is just some work to be done. Also, I would wonder why auto-scheduling mail at all. If you had to, say, say product news, information bulletin, magazine issue, etc., to registered users who did not opt it out, you would just send a single message to the group. Or is it anything else?
—SA
Member 10858162 4-Aug-14 23:57pm    
Thank for your comment. The idea is that user can set timeframe to send and send a automatic message e.g payment reminder.
ZurdoDev 4-Aug-14 13:54pm    
First off, using ASP.Net for scheduled tasks is a terrible idea. I would suggest you take your code and move it into a Windows Service. ASP.Net code only runs when users visit your site so scheduling things is not a good idea.
Sergey Alexandrovich Kryukov 5-Aug-14 0:28am    
Agree. But I still be wondering the purpose of such activity. As you probably understand, every attempt to schedule such thing as mail sending can be considered as potentially suspicious. It would be good to know if it is something legitimate. :-)
—SA
Thomas Nielsen - getCore 19-Aug-14 2:42am    
I didn't read the article that inspired you. But generally you should not use ASP.Net to schedule if it can be avoided. The problem is that the WAS will recycle your application pool if it is unsused for a while.
Of cause frequent enough activity can make it work (stay alive) but then you'll need globals and other that really doesn't inherently work well with the stateless nature of ASP.net
So i would recommend if you must host on iis to use a wcf service. This one can be configured to more or less stay alive and cannot get called directly at least if you have some level of security.
If you can move the code to a Windows service, like RyanDev suggested, it would be preferable to avoid sharing life and death with the iis service subject to it's thread handling.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900