Solved

Scheduling an email using Windows Scheduler in asp.net

Posted on 2011-09-09
5
422 Views
Last Modified: 2012-06-21
I want to Scheduling an email using Windows Scheduler in asp.net.

I want to mail automatically send on 1 week and 1 month.

Please give me code or detail how to do in asp.net.

Please give me as soon as possible.

Thanking you
0
Comment
Question by:citadelind
  • 4
5 Comments
 
LVL 8

Expert Comment

by:Amitabh Singh
ID: 36510431
hi
i just able to provide you link because i never did this via ASP.NET

have a look to the post below for code

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22966978.html?sfQueryTermInfo=1+10+30+asp.net+mail+send



Hear is a Microsoft doc for same staff

http://msdn.microsoft.com/en-us/magazine/cc163821.aspx

0
 
LVL 8

Expert Comment

by:Amitabh Singh
ID: 36510452
and why not just use the regular windows scheduler to  sends the emails via VBS ? Is there a reason it needs to be launched from within ASP.NET originally?
0
 
LVL 8

Expert Comment

by:Amitabh Singh
ID: 36510476
VBS Example

Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Display
strEmailAddr  = "me.me@you.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Body = "Hi"
objMailItem.Attachments.Add "file.xml"
objMailItem.Send
Set objMailItem = nothing
Set objOutl = nothing

Open in new window

0
 

Author Comment

by:citadelind
ID: 36515146
Please give me specific code so i can apply easily

Or Give me some link so i will see that
0
 
LVL 8

Accepted Solution

by:
Amitabh Singh earned 500 total points
ID: 36515248
ok   then do it like this , Steps are fallowing !

Login to your IIS (web server) and Install SMTP on it .
Procedures
--------------------------------------------------------------------------------------------
To install the SMTP service
1.From the Start menu, click Control Panel.

2.Double-click Add or Remove Programs.

3.From the left pane, click Add/Remove Windows Components.

4.From the Components list, click Application Server, and then click Details.

5.From the Subcomponents of Application Server list, click Internet Information Services (IIS), and then click Details.

6.From the Subcomponents of Internet Information Services (IIS) list, select the SMTP Service check box.

7.Click OK.

8.Click Next. You might be prompted for the Windows Server 2003 family CD or the network install path and Click Finish.
--------------------------------------------------------------------------------------------
HTML mail configuration
--------------------------------------------------------------------------------------------
generate a HTML page via ASP.NET which  you want in your email in body and place in local storage , example
i place my html file in c:/week/Doc1.htm and c:/month/Doc1.htm

now .. now create a text file inside c:/week/ place fallowing code in it and save as send.vbs
 
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Test HTML Code"
objMessage.From = "repo@send.local"
objMessage.To = "me@send.local"
objMessage.HTMLBody = "<h1>HTML Mail test.</h1>"
objMessage.CreateMHTMLBody "file://c:/week/Doc1.htm"
objMessage.Send

Open in new window


and now same for month
create a text file inside c:/month/ place fallowing code in it and save as send.vbs
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Test HTML Code"
objMessage.From = "repo@send.local"
objMessage.To = "me@send.local"
objMessage.HTMLBody = "<h1>HTML Mail test.</h1>"
objMessage.CreateMHTMLBody "file://c:/month/Doc1.htm"
objMessage.Send

Open in new window

now go to windows schedule task create 2  1st task will run every week and run  fallowing command cscript c:/week/send.vbs
run the task and check if you received mail

now do the same for month
create a new task that will run every month and run  fallowing command cscript c:/month/send.vbs
run the task and check if you received mail
------------------------------------------------------------------------------------------------------
Note : be remember your ASP.net need to replace (or delete old one and create a new file ) c:/week/Doc1.htm and c:/month/Doc1.htm every time .
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question