thomasgeorgem
Newcomer
- Joined
- Aug 17, 2009
- Messages
- 4
I have a piece of code as below.
--------------------------------------------------
Dim MailServer As String = "THOMAS" 'Local SMTP virtual svr
Dim ToEmail As String = "thomas@mydomain.com"
Dim ToName As String = "Thomas George"
Dim FromEmail As String = "test@mydomain.com"
Dim FromName As String = "Test"
Dim Subject As String = "Test Mail"
Dim Body As String = "Test Body"
Dim o_Client As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient(MailServer)
Dim o_FromAddress As System.Net.Mail.MailAddress = New System.Net.Mail.MailAddress(FromEmail, FromName)
Dim o_ToAddress As System.Net.Mail.MailAddress = New System.Net.Mail.MailAddress(ToEmail, ToName)
Dim o_Message As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage(o_FromAddress, o_ToAddress)
o_Message.Subject = Subject
o_Message.Body = Body
AddHandler o_Client.SendCompleted, AddressOf sendMail_SendCompleted
o_Client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
Try
o_Client.Send(o_Message)
Catch exc As Exception
End Try
--------------------------------------------------
The problem is nothing happening, no error returned.
Can anybody say what could be wrong.
thank you,
Thomas George
--------------------------------------------------
Dim MailServer As String = "THOMAS" 'Local SMTP virtual svr
Dim ToEmail As String = "thomas@mydomain.com"
Dim ToName As String = "Thomas George"
Dim FromEmail As String = "test@mydomain.com"
Dim FromName As String = "Test"
Dim Subject As String = "Test Mail"
Dim Body As String = "Test Body"
Dim o_Client As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient(MailServer)
Dim o_FromAddress As System.Net.Mail.MailAddress = New System.Net.Mail.MailAddress(FromEmail, FromName)
Dim o_ToAddress As System.Net.Mail.MailAddress = New System.Net.Mail.MailAddress(ToEmail, ToName)
Dim o_Message As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage(o_FromAddress, o_ToAddress)
o_Message.Subject = Subject
o_Message.Body = Body
AddHandler o_Client.SendCompleted, AddressOf sendMail_SendCompleted
o_Client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
Try
o_Client.Send(o_Message)
Catch exc As Exception
End Try
--------------------------------------------------
The problem is nothing happening, no error returned.
Can anybody say what could be wrong.
thank you,
Thomas George