Wrox Programmer Forums
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2004, 09:39 AM
Authorized User
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default SmtpMail.Send vs CDO.Message

If the SMTP server is not running:

- ASP.NET: SmtpMail.Send throws an exception.
- Classic ASP: CDO.Message send places a message file in the mailroot/pickup folder that is sent out when the server is restarted.

I want the classic ASP behaviour so I tried to workaround this in ASP.NET by adding a reference to CDO.DLL so I could create a CDO.MessageClass object. This works, but the behavior is identical to SmtpMail.Send. Same result if I instantiate CDO.Message instead of CDO.MessageClass.

I also find that under .NET 1.1 I have to set the SMTP Server access to allow anonymous access. I've tried doning authentication but I'm going wrong somewhere. I'm using my system adminstrator logon and password but still get authentication errors. CDO.Message send under classic ASP is not affected.

Anyone have a clue?

Thanks,

Richard Waddell



 
Old August 6th, 2004, 09:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:- ASP.NET: SmtpMail.Send throws an exception.
Can you post the exact exception that it throws?

_________________________
- Vijay G
Strive for Perfection
 
Old August 7th, 2004, 11:02 AM
Authorized User
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't remember the exact exception but the solution is to use the Fields property of SmtpMail:
Set sendusing and postusing to 'pickup'.
Set smtpserverpickupdirectory and nntpserverpickupdirectory, typically to "C:\InetPub\mailroot\Pickup".
Set flushbuffersonwrite to True (not strictly necessary I don't think)

Here's my theory of how this came about.
1. Under Classic ASP, CDO.Message defaults to the above settings.
2. SmtpMail under the 1.0 Framework did not allow access to the Fields collection, so MS kept the same default settings for the wrapped CDO Message object.
3. SmtpMail under the 1.1 Framework does allow access to the Fields collection, so MS decided the defaults weren't appropriate now that users had access to the fields collection.

Unfortunately they apparently didn't document any of this, so unless you're already familiar with CDO beyond just taking the defaults under Classic ASP and then the SmtpMail defaults under the 1.0 framework, then you're pretty much clueless as to what's going on under 1.1. I didn't even know the fields collection existed. When you go to the 1.1 Framework MSDN documentation for SmtpMail.Fields you find 'to be defined'.

Regards,

Richard Waddell





 
Old August 7th, 2004, 09:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Richard,

I think you are referring to MailMessage class's Field property.

Being not sure about the exception that you faced, I am not sure where to point you to. But I think this might help you as to know how to access FIELDs collection.
System.Web.Mail and Authentication

SMTP Authentication using System.Web.Mail (CDOSYS)

System.Web.Mail FAQ

You may take a look at this thread too - email sending

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 7th, 2004, 09:52 PM
Authorized User
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is solved, I was just telling you what I had to do to solve it.







Similar Threads
Thread Thread Starter Forum Replies Last Post
About SmtpMail.Send() Method hhkris4u ASP.NET 1.0 and 1.1 Professional 3 February 6th, 2007 04:24 AM
how to send HTML email by using CDO.Message ittech Classic ASP Basics 2 January 10th, 2006 06:49 PM
How to send HTML email by using CDO.Message ittech Classic ASP Components 1 January 10th, 2006 06:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.