I have a websit开发者_如何学JAVAe and would like to send out emails regularly one or twice a week.
One method I know of sending a email say every thursday at 5:30pm would be to have a windows service start up at the correct time and open a webpage of my website. This page would be a hidden page which then would make all the emails and send them out!
This is a bit of a dirty way to do things but it does mean I simply just have to create a new page in my website and not do alot more...
Is their a better way to do this? I could make a stand alone application/cmd line program which connects to the database and does the same but this would require more work with setting up the connection to the database and more..
Whats everyones opinions on possible methods to do this task?
From a security standpoint and for other reasons I would recommend offloading this to a windows service or a .NET app that you schedule via Task Scheduler as in the end it is going to give you more flexibility, stability, and security over the alternative. Just to give you a few reasons.
No timeouts to worry about if your site grows and the e-mail processing takes more time than expected.
No need to publicly expose an email blast trigger where a malicious user could try to send e-mails when not needed.
You separate the e-mailing functionality out into its own component that can run on its own, that way if you need more functionality it will be easier to extend later
精彩评论