HELP: Error when sending email in VB.NET

V

VB Programmer

I am making a simple VB.NET app to send emails. I put a test button on the
form with code like this:
Imports System.Web.Mail
:
Dim msgEmail As New System.Web.Mail.MailMessage

With msgEmail
.To = txtTestEmailAddress.Text
.From = "(e-mail address removed)"
.Body = "This is a test email."
.Subject = "Test Email."
.BodyFormat = Web.Mail.MailFormat.Text
End With

System.Web.Mail.SmtpMail.SmtpServer = "smtp.fdn.com"
System.Web.Mail.SmtpMail.Send(msgEmail)
MessageBox.Show("Message sent to " & msgEmail.To & ".")

Running it locally works fine. When I upload it to the server and run the
app, clicking on the button produces this error:
Could not access 'CDO.Message' object. - System.Web - at
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at AutomatedPowerwebEmailSystem.frmMain.txtSendTestEmail_Click(Object
sender, EventArgs e)

Any ideas?

Thanks.
 
H

Herfried K. Wagner [MVP]

* "VB Programmer said:
I am making a simple VB.NET app to send emails. I put a test button on the
form with code like this:
Imports System.Web.Mail
:
Dim msgEmail As New System.Web.Mail.MailMessage

With msgEmail
.To = txtTestEmailAddress.Text
.From = "(e-mail address removed)"
.Body = "This is a test email."
.Subject = "Test Email."
.BodyFormat = Web.Mail.MailFormat.Text
End With

System.Web.Mail.SmtpMail.SmtpServer = "smtp.fdn.com"
System.Web.Mail.SmtpMail.Send(msgEmail)
MessageBox.Show("Message sent to " & msgEmail.To & ".")

Running it locally works fine. When I upload it to the server and run the
app, clicking on the button produces this error:
Could not access 'CDO.Message' object. - System.Web - at
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at AutomatedPowerwebEmailSystem.frmMain.txtSendTestEmail_Click(Object
sender, EventArgs e)

Did you have a look here?

<http://groups.google.com/groups?q=dotnet+cdo.message>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top