G
Guest
Hi,
I have following codes in VB6 for sending the email on a server installed
SMTP. It works fine. Now I want to update it with VB.NET 2.0 by using
..NET.Mail object.
VB6 code:
Dim myMail
Set myMail=CreateObject("CDO.Message")
myMail.Subject = "Sending email with CDO"
myMail.From = "Testing"
myMail.To = "(e-mail address removed)"
myMail.TextBody = "This is a message."
myMail.Send
Set myMail = Nothing
VB.NET codes:
Dim myMail As New MailMessage
myMail.From = New MailAddress("Testing")
myMail.To.Add("(e-mail address removed)")
myMail.Subject = "Sending email with Net.Mail"
myMail.Body = "This is a message."
Dim client As New SmtpClient()
client.Host = [myservername]
client.Send(myMail)
I had an error when fetched .From property which is omited in VB6, I want to
know what I have to put there? If I run it from server, do I need to set host
property?
How to make it work properly?
Thanks in advance
I have following codes in VB6 for sending the email on a server installed
SMTP. It works fine. Now I want to update it with VB.NET 2.0 by using
..NET.Mail object.
VB6 code:
Dim myMail
Set myMail=CreateObject("CDO.Message")
myMail.Subject = "Sending email with CDO"
myMail.From = "Testing"
myMail.To = "(e-mail address removed)"
myMail.TextBody = "This is a message."
myMail.Send
Set myMail = Nothing
VB.NET codes:
Dim myMail As New MailMessage
myMail.From = New MailAddress("Testing")
myMail.To.Add("(e-mail address removed)")
myMail.Subject = "Sending email with Net.Mail"
myMail.Body = "This is a message."
Dim client As New SmtpClient()
client.Host = [myservername]
client.Send(myMail)
I had an error when fetched .From property which is omited in VB6, I want to
know what I have to put there? If I run it from server, do I need to set host
property?
How to make it work properly?
Thanks in advance