any suggested trick to do that?

Recommended Answers

All 10 Replies

Your question needs clarification. You are trying to send an email to a specific email address? What do you mean automatically? During a postback, submit button, some other event?

No, sorry for that i didn't type clearly.
Is similiar to reminder function, it will automatically send email to several email address. (Without any end-users fire the events)
Just is automatic send the email when is date is today or etc.

it will automatically send email to several email address. (Without any end-users fire the events)

So obvisouly, this wouldnt work well within an asp.net application because you would need sometype of event to occur. You could run a procedure in the background every time a web page is accessed, but that is not an appropriate or effecient solution.

A stand-alone .net application would work better and you can run it as a service on your server.

However, the approach that I have always taken is to handle this process from MS SQL as a re-occuring job (via the SQL Server Agent). For example, I would simply write a stored procedure that would query my DB tables, and generate the HTML response and loop through my list of target users and send mail directly to each target user.

If you use SQL to manage this process, this is what I've used within my stored procedure...

sp_send_dbmail (Transact-SQL)

The link is useful for me, but how to create the SQL Server Agent? or any step to do first before coding the procedure?

You don't create the SQL server agent but you should see it as a service. You may simply need to start it. If you use SQL Management Studio, you should see the agent component towards the bottom of list of components on the left window.

Here's more info http://technet.microsoft.com/en-us/library/ms189237.aspx

i don't see any agent keyword. :/

Oh.. I suspect you are running SQL Express. :-(.

Sorry about forgetting to mention its not included in that version.

The other option is to compile a .net app, and run it on schedule.

You could also do this in asp.net... Create a page that is for the purpose of running this process, no output to the user. Then create a cron job (free services online) that will call this page on schedule. On page load event, run the code to email.

Any sample able to search online or tutorials?
Will this schedule will automatically execute whenever i doesn't running the page?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.