here is th error message:
Exception information:
Exception type: SmtpException
Exception message: Failure sending mail.
Thread information:
Thread ID: 5
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Net.Mail.SmtpClient.Send(MailMessage message)
at registeration.SendMail(String toEmail, String fromEmail) in D:\Applications\bidlet\registeration.aspx.vb:line 41
at registeration.btnReg_Click(Object sender, EventArgs e) in D:\Applications\bidlet\registeration.aspx.vb:line 6
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
here is my code:
Protected Sub btnReg_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReg.Click
''''send message from visitor to me
SendMail("Bid.Letting@dot.state.mn.us", txtEmail.Text)
''''send message from you to visitor
SendMail(txtEmail.Text, "Bid.Letting@dot.state.mn.us")
End Sub
Private Sub SendMail(ByVal toEmail As String, ByVal fromEmail As String)
Dim objEmail As New MailMessage
objEmail.To.Add(toEmail)
objEmail.CC.Add(toEmail)
objEmail.From = New MailAddress(fromEmail)
Dim sMsg As System.String
Dim rcvdEmail As String = toEmail
If rcvdEmail = "Bid.Letting@dot.state.mn.us" Then
sMsg = "Your registeration has been recieved." & vbCrLf & "The results are as follows:" & vbCrLf
sMsg += "Email Address : " & txtEmail.Text & vbCrLf
sMsg += "Contact Person Name : " & txtVendor.Text & vbCrLf
sMsg += "Vendor Id : " & txtVendId.Text & vbCrLf
sMsg += "Phone Number : " & txtPhone.Text & vbCrLf
sMsg += "Fax Number : " & txtFax.Text & vbCrLf
If drpDistrict.SelectedValue = 0 Then
sMsg += "Closest District: " & "Duluth" & vbCrLf
ElseIf drpDistrict.SelectedValue = 1 Then
sMsg += "Closest District: " & "Bemigji" & vbCrLf
ElseIf drpDistrict.SelectedValue = 2 Then
sMsg += "Closest District: " & "Brainerd" & vbCrLf
ElseIf drpDistrict.SelectedValue = 3 Then
sMsg += "Closest District: " & "Detroit Lakes" & vbCrLf
ElseIf drpDistrict.SelectedValue = 4 Then
sMsg += "Closest District: " & "Metro" & vbCrLf
ElseIf drpDistrict.SelectedValue = 5 Then
sMsg += "Closest District: " & "Rochester" & vbCrLf
ElseIf drpDistrict.SelectedValue = 6 Then
sMsg += "Closest District: " & "Mankato" & vbCrLf
Else : drpDistrict.SelectedValue = 7
sMsg += "Closest District: " & "Willmar" & vbCrLf
End If
If rdYes.Checked = True Then
sMsg += "Could you be interested in attending Electronic Bid Submittal Training? " & "Yes"
Else
sMsg += "Could you be interested in attending Electronic Bid Submittal Training? " & "No"
End If
objEmail.Subject = "Training Registeration "
''''objEmail.Attachments.Add(New Attachment(AttachementFile.PostedFile.InputStream,
''''AttachementFile.FileName))
objEmail.Body = sMsg
objEmail.IsBodyHtml = False
Else
sMsg = "Please do not respond, this is an automated message to let" & vbCrLf
sMsg += "you know that your registeration has been received." & vbCrLf
sMsg += "We will take aproperiate action." & vbCrLf
sMsg += "Thank you," & vbCrLf
sMsg += "Mn/DOT, Office of Construction and Innovative Contracting "
objEmail.Subject = "Training Registeration confirmation"
objEmail.Body = sMsg
End If
Dim SmtpMail As New SmtpClient()
SmtpMail.Send(objEmail)
End Sub