I write the following code to send email. I don't get error message and also don't receive message. Please check for me.
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.UseDefaultCredentials = False
SmtpServer.Credentials = New Net.NetworkCredential("myMail@company.com.sg", "password")
SmtpServer.Port = 80
SmtpServer.Host = "webmail.company.com.sg"
mail = New MailMessage()
mail.From = New MailAddress("myMail@company.com.sg")
mail.To.Add("receiver@gmail.com")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail"
SmtpServer.Send(mail)
Label1.Text = "mail send"
Catch ex As Exception
Label1.Text = ex.ToString
End Try
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.UseDefaultCredentials = False
SmtpServer.Credentials = New Net.NetworkCredential("myMail@company.com.sg", "password")
SmtpServer.Port = 80
SmtpServer.Host = "webmail.company.com.sg"
mail = New MailMessage()
mail.From = New MailAddress("myMail@company.com.sg")
mail.To.Add("receiver@gmail.com")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail"
SmtpServer.Send(mail)
Label1.Text = "mail send"
Catch ex As Exception
Label1.Text = ex.ToString
End Try