I have a web part that is attempting to send email and I'm using the
regular System.Web.Mail namespace to do this. I am currently getting
the following error message when I attempt to send the mail:
Could not access 'CDO.Message' object. 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 AIU.CustomWebParts.LifeSupport.SendMail() in
C:\Inetpub\wwwroot\ServiceProposals.root\ServiceProposals\LifeSupport.
vb:line 490 at AIU.CustomWebParts.ServiceProposalWebPart.OnInit
(EventArgs e) in
C:\Inetpub\wwwroot\ServiceProposals.root\ServiceProposals\ServicePropo
salWebPart.vb:line 447
I have heard that Sharepoint has its own methods of sending email.
Maybe I should use that instead because it doesn't appear that what I
have is going to work. My code is below.
Code:
Dim objMail As New MailMessage
With objMail
.Body = Me.lsEmailBody
.Cc = Me.lsCC
.To = Me.lsTo
.Subject = Me.lsEmailSubject
SmtpMail.SmtpServer = "<ExchangeServer>"
SmtpMail.Send(objMail)
End With