Connection is made to my smtp server (shown in log files) but the message is never sent. Is there something wrong with my code or is it something else????????
Private Sub sendAsEmailButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sendAsEmailButton.Click
Dim form As New EmailData()
form.ShowDialog()
Dim toaddress = form.toAddressTextBox.Text
Dim ccaddress = form.ccAddressTextBox.Text
Try
Dim msg As New MailMessage()
msg.From = New MailAddress("my@email.com")
msg.To.Add(toaddress)
If Not ccaddress = "" Then
msg.CC.Add(ccaddress)
End If
msg.Subject = "forced message title"
msg.IsBodyHtml = False
msg.Body = BuildMessage() 'returns message body as string
Dim smtp As New SmtpClient("mail.mysmtpserver.com")
smtp.Port = 25
smtp.Credentials = New System.Net.NetworkCredential("myuaername", "mypassword")
smtp.Send(msg)
Catch ex As Exception
End Try
End Sub
This post has been edited by redleg: 20 November 2010 - 04:55 AM

New Topic/Question
Reply




MultiQuote




|