ARTICLE

CDO Object in Web Services

Posted by Kumar Sethuraman Articles | Visual Basic 2010 February 14, 2006
This article suggest how to resolve the issue "Could not access'CDO.Message'" while using SMTP to send email on web services.
 
Reader Level:

When I was using SMTP to send email on web services. i had experienced the error "Could not access'CDO.Message' " so many times. Finally i had resolved by specifying the localhost as default server. And by the following suggestion on IIS MMC.

Suggestion 1.

If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, you may not have permissions to relay through the IID SMTP Service. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Relay button. In the Relay Restrictions dialog, grant your IP address (127.0.0.1) to the Computers listbox. Close down all dialogs, and restart the SMTP Service.

Suggestion 2.

If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, make sure Anonymous access is allowd. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Authentication button. Be sure "Anonymous Access" is the only checkbox checked. Close down all dialogs, and restart the SMTP Service.

And try this function to send emails using SMTP.

<WebMethod()> _
Public Function SendErrorToComany() As String
   Try
       Dim insMail As New MailMessage
       With insMail
           .From = kumarsethuraman@hotmail.com
           .To = kumarsethuraman@hotmail.com
           .Subject = "Body of the message"
           .Body = pErr
       End With
       SmtpMail.SmtpServer = "localhost"
       SmtpMail.SmtpServer.Insert(0, "127.0.0.1")
       SmtpMail.Send(insMail)
       Return "1"
   Catch err As Exception
       Return err.StackTrace & err.Message & err.Source
   End Try
End Function

share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor