i am doing onlineeducation project.in that,how to send mails to every student from our mailserver daily at 12pm without our interaction.i am using consoleapplication in vb.net.can anyone please help me

thank you in advance

Use the classes of System.Net.Mail namespace.

thank you for quick reply.
yes iam using sys.net.mail.
i want how to automate(i.e., at 12 daily a mail has to be sent to all the students who are learning the course

What is your concern about automate. Create a service application.

thank for replying.... my requirement is to send mail daily at night without my interaction.somebody said to use timers..like that.but i dont know how to use.please help me

hi vijayakumar can you plz give code so that its easy to understand and do something with that code???

Sub Main()
Dim strMSG As String
Dim strArgs() As String = Command.Split(",")
Dim blnSMTP As Boolean = False
Dim blnCC As Boolean = False
Dim blnAttachments As Boolean = False

'get the product name, version and description from the assembly
strMSG = vbCrLf + vbCrLf + _
System.Diagnostics.FileVersionInfo.GetVersionInfo( _
System.Reflection.Assembly.GetExecutingAssembly.Location).ProductName _
+ " v" + System.Diagnostics.FileVersionInfo.GetVersionInfo( _
System.Reflection.Assembly.GetExecutingAssembly.Location _
).ProductVersion + vbCrLf + _
System.Diagnostics.FileVersionInfo.GetVersionInfo( _
System.Reflection.Assembly.GetExecutingAssembly.Location _
).Comments + vbCrLf + vbCrLf

If UBound(strArgs) < 3 Then
strMSG = strMSG + "Usage: LeadSolSendMail LeadSol@email.com, " + _
"to@email.com, subject, message, [smtp Server]," + _
"[cc1@email.com;cc2@email.com;...], [attachment1;" + _
"attachment2;...]" + vbCrLf
Console.Write(strMSG)
Exit Sub
End If

strMSG = strMSG + "Sending email message" + vbCrLf + _
" From --> " + Trim(strArgs(0)) + vbCrLf + _
" To --> " + Trim(strArgs(1)) + vbCrLf + _
" Subject --> " + Trim(strArgs(2)) + vbCrLf + _
" Message --> " + Trim(strArgs(3)) + vbCrLf
If UBound(strArgs) >= 4 Then
If Len(Trim(strArgs(4))) > 0 Then
blnSMTP = True
strMSG = strMSG + " SMTP Server --> " + Trim(strArgs(4)) + _
vbCrLf
End If
End If
If UBound(strArgs) >= 5 Then
If Len(Trim(strArgs(5))) > 0 Then
blnCC = True
strMSG = strMSG + " CC --> " + Trim(strArgs(5)) + _
vbCrLf
End If
End If
If UBound(strArgs) >= 6 Then
If Len(Trim(strArgs(6))) > 0 Then
blnAttachments = True
strMSG = strMSG + " Attachments --> " + Trim(strArgs(6)) + _
vbCrLf
End If
End If
Console.Write(strMSG)

'send the email
Try
Dim insMail As New MailMessage()
With insMail
.From = Trim(strArgs(0))
.To = Trim(strArgs(1))
.Subject = Trim(strArgs(2))
.Body = Trim(strArgs(3))
If blnCC Then .Cc = Trim(strArgs(5))
If blnAttachments Then
Dim strFile As String
Dim strAttach() As String = Split(strArgs(6), ";")
For Each strFile In strAttach
.Attachments.Add(New MailAttachment(Trim(strFile)))
Next
End If
End With
If blnSMTP Then SmtpMail.SmtpServer = Trim(strArgs(4))

SmtpMail.Send(insMail)

Console.WriteLine("Successfully sent email message" + vbCrLf)

Catch err As Exception
Console.WriteLine("EXCEPTION " + err.Message + vbCrLf)
End Try

End Sub

this is my code and i want to send daily mail to all students at night 12 without my interation.i didnt write any code for that.my doubt is ....i got all usermailids into tomail() function.now from i have to call this funtion and how to send daily by time.

commented: Code tag!! -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.