Problem in sending CDO Mail via VB.Net

liunx

Guest
Hai,

I need to send a mail in my vb.net project.

I have included the below code.
-----------------------------------------

Dim objConfig, objMail
Dim fields
objConfig = Server.CreateObject("CDO.Configuration")
fields = objConfig.fields
With fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "123.456.7.8"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update()
End With

objMail = Server.CreateObject("CDO.Message")
objMail.configuration = objConfig

objMail.from = "[email protected]"
objMail.cc = "[email protected]"

strFromAddress = "[email protected]"
objMail.subject = ConfigurationSettings.AppSettings("Registration_MailSubject")
objMail.HTMLBody = lblMessge.Text & "<br>" & lblInv.Text & "<br>" & lblCustCodeDisp.Text & "<br>" & lblCorres.Text
System.Web.Mail.SmtpMail.Send(objMail)
objMail = Nothing
-----------------------------------------

I have also imported System.Web.mail in the page.
But it gives the below error message as,

-----------------------------------------
Library not registered.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Library not registered.
-----------------------------------------

Kindly suggest me a solution.
It is urgent.

Thanks and regards,
Siva R
 
Back
Top