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.
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.