Solved

Scheduling an email using Windows Scheduler in asp.net

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now