Solved

Scheduling an email using Windows Scheduler in asp.net

Posted on 2011-09-09
5
439 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET Content Page 3 52
Running powershell scripts from ASP.NET 6 59
Securing WEBAPI on Azure 2 27
Connect Gridview column to Textbox in C# 2 41
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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