Lowyat.NET Forums

Welcome Guest ( Log In | Register )

LYN wins Intel-Lenovo-Tangs Blogathon challenge. Thank you everybody!
 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> VB.NET Task scheduler, To send email (.NET)

gsrc
post Jun 29 2009, 03:09 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #1


Casual
***

Group: Junior Member
Posts: 336
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Apr 2007
From: SS17 PJ, Malaysia





Hi I wish to ask all the people here for help.

I'm developing a small application that will send an email everyday to a group of users. I've done the sending email part.

But the problem is how do I make use of Task Scheduler to "click" the send button at the scheduled time?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
geekster129
post Jun 29 2009, 03:39 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #2


Casual
***

Group: Junior Member
Posts: 338
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2007
From: LittleBIGPlanet





QUOTE(gsrc @ Jun 29 2009, 03:09 PM)
Hi I wish to ask all the people here for help.

I'm developing a small application that will send an email everyday to a group of users. I've done the sending email part.

But the problem is how do I make use of Task Scheduler to "click" the send button at the scheduled time?
*



Is it possible for your program to accept command-line arguments?

If this is possible, then you may to have to modify your program at the Form_Load() section to run if certain keyword is detected. I.e.

c:\documents and settings\geekster129\desktop>sendmail.exe -sendmail

Once this works, in the Task Scheduler, put this command as the script you want to run.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
gsrc
post Jun 29 2009, 04:08 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #3


Casual
***

Group: Junior Member
Posts: 336
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Apr 2007
From: SS17 PJ, Malaysia





QUOTE(geekster129 @ Jun 29 2009, 03:39 PM)
Is it possible for your program to accept command-line arguments?

If this is possible, then you may to have to modify your program at the Form_Load() section to run if certain keyword is detected. I.e.

c:\documents and settings\geekster129\desktop>sendmail.exe -sendmail

Once this works, in the Task Scheduler, put this command as the script you want to run.
*

Yes I'll be deploying it at a centralized server.

What does the -sendmail does?

Is it a function inside the form file? Like Private Sub Sendmail()?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
geekster129
post Jun 29 2009, 04:17 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #4


Casual
***

Group: Junior Member
Posts: 338
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2007
From: LittleBIGPlanet





QUOTE(gsrc @ Jun 29 2009, 04:08 PM)
Yes I'll be deploying it at a centralized server.

What does the -sendmail does?

Is it a function inside the form file? Like Private Sub Sendmail()?
*



Sorry, the -sendmail is just an example command-line argument for the program to identify that it's a command-line argument. It can be any names you want.

I created a simple VB6 program to test it. You may need to modify the coding for VB.NET

The coding are as follows:

Create this in a Module (.bas)

Sub Main()
'MsgBox Command
If Command = "-sendmail" Then
'do the sendmail
MsgBox "Sending the mail"
Else
Form1.Show
End If
End Sub



This post has been edited by geekster129: Jun 29 2009, 04:27 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
narf03
post Jun 30 2009, 11:55 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #5


Regular
******

Group: Senior Member
Posts: 1,641
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2004
From: Metro Prima, Kuala Lumpur, Malaysia, Earth, Sol





use a timer to check the time and
btn001.performclick()
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dkk
post Jul 3 2009, 01:40 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #6


Casual
***

Group: Junior Member
Posts: 471
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003




I would just use cron. It's a Unix utility, but there are plenty of Windows ports around for free.

Modify your program so you don't need to click SEND. When you run it, it sends the email immediately. Then set cron to run your program at the same time everyday.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 24th November 2009 - 05:47 AM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)