Cannot send emails from asp.net
Posted on 2005-04-08
i am trying to send email to a list of email addresses retrieved from sql server, but it doesn't seem to be sending. i even tried to send it to my own address but i still get nothing. i looked in C:\Inetpub\mailroot\ and in the Queue folder i have two messages there. i went into IIS to see if smpt is running, and it is.
how can i get the emails to send?
here is the code below, i dont know if i'm doing something wrong here:
If DropDownList2.SelectedValue = "0" Then
Dim Sqlstrg As SqlConnection
Dim Sqlquery As String
Dim cmdSelect1 As SqlCommand
Sqlstrg = New SqlConnection("server=localhost;uid=sa;pwd=;database=stmdb;")
Sqlquery = "SELECT EmailAddress, IsStudent FROM TblUsername WHERE IsStudent = '1'"
cmdSelect1 = New SqlCommand(Sqlquery, Sqlstrg)
Dim objMailMsg As MailMessage
objMailMsg = New MailMessage
objMailMsg.To = "Sqlquery"
objMailMsg.Subject = "New coursework document"
objMailMsg.Priority = MailPriority.High
objMailMsg.Body = "this is a test"