[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

How would I get a web site to Delay sending an email for 5 min (ASP.NET C)#

I don't know how to go about this, and am looking for some direction.  I need my site to send an email out, but this is the issue.  Send it out 5 minutes after they click the button, or close the browser.  Is this possible and if so, how?
0
bmanmike39
Asked:
bmanmike39
  • 2
  • 2
1 Solution
 
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
Send it out 5 minutes after they click the button

// Make thread to pause for few minutes
System.Threading.Thread.Sleep(300000);
// Your code for sending email here

Open in new window


More details available at - C# Sleep
0
 
Carl TawnSystems and Integration DeveloperCommented:
Normally you would have a separate service to handle sending the email at an appointed time, or after a specific delay. You certainly don't want to be sleeping a thread in a web application as suggested above!
0
 
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
I do agree with Carl Tawn. The solution was suggestive but not recommended for production environment. Thanks Carl for pointing it out.
0
 
bmanmike39Author Commented:
If this is not safe than it will not work for me.
0
 
bmanmike39Author Commented:
Thanks but this is no good to me if it's unsafe, but no one is responding.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now