Hi James,
Thank you for your update.
I have done a lot of research regarding this issue but I cannot reproduce
the error on my side.
That is to say, the following statement works on my side. (The "()" will be
removed by the VS.NET 2003 IDE automatically.)
Dim oMsg As New MailMessage
The following is my testing code. Please try it on your side.
----------------------------------------------------------------------------
-----------
Imports System.Web.Mail
Module Module1
Sub Main()
'Dim oMsg As MailMessage = New MailMessage
Dim oMsg As New MailMessage
' TODO: Replace with sender e-mail address.
oMsg.From = ""
' TODO: Replace with recipient e-mail address.
oMsg.To = ""
oMsg.Subject = "Send using Web Mail"
' SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.BodyFormat = MailFormat.Html
'HTML Body (remove HTML tags for plain text).
oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>"
' ADD AN ATTACHMENT.
' TODO: Replace with path to attachment.
' Dim sFile As String = "C:\temp\Hello.txt"
' Dim oAttch As MailAttachment = New MailAttachment(sFile,
MailEncoding.Base64)
'
' oMsg.Attachments.Add(oAttch)
' TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "smarthost"
SmtpMail.Send(oMsg)
oMsg = Nothing
' oAttch = Nothing
End Sub
End Module
------------------------------------------------------
If I have misunderstood your concern, please feel free to let me know.
Best regards,
Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.