Classic ASP sending email to a Windows 2008 server - error "8004020f"

I am trying to send an email with classic ASP (I am stuck with an old application, so I need to use classic ASP here) on Windows Server 2008 R2, IIS 7.5.

I think a lot has changed from Win Server 2003 to 2008. I use the following code, but I get this error (BTW, the error message is so "informative");

error '8004020f'

/poo.asp line 32

Here is the code:

<!-- METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" --> <% 'Declare variables Dim sch, cdoConfig, cdoMessage sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = CreateObject("CDO.Configuration") With cdoConfig.Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "mail.example.com" 'Set SMTP port which is 25 by default .Item(sch & "smtpserverport") = 587 .Update End With Set cdoMessage = CreateObject("CDO.Message") With cdoMessage Set .Configuration = cdoConfig .From = " info@example.com " .To = " me@example2.com " .Subject = "Sample CDO Message" .TextBody = "This is a test for CDO.message" .Send End With Set cdoMessage = Nothing Set cdoConfig = Nothing Response.write "<HTML><head><title>A message has been sent.</title></head><body>A message has been sent.</body></HTML>" %> 

In addition, I just installed the Microsoft Exchange Server MAPI Client and collaboration data objects 1.2.1 from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=1004 on my server, but nothing has changed.

NOTE. I can send email through localhost if it works. irrelevant.

+4
source share
1 answer

You may encounter the following error:

error '8004020f' The event class for this subscription is in

invalid section

This error message appears from cdosys.h and has nothing to do with any "section" - in fact, it is related to other errors in the overloaded message. The error code is actually attributed to the following:

 CONST LONG CDO_E_RECIPIENTS_REJECTED = 0x8004020FL 

This means that the email was rejected by the server for some reason. Here are a few things you can try to fix the problem:

  • Verify that the SMTP server allows anonymous (unauthenticated) relaying. If your SMTP requires outgoing authentication, see Article # 2026 .

  • Check to see if the problem is related to the domain names used in the email addresses of the recipients. For example, some users complained that they could only send users their domain; others said they could send to any domain other than their own (see article No. 2511 for some potential reasons and solutions).

  • Perhaps the email address is simply rejected, but other configuration settings on the SMTP server do not allow the true error message to be sent back to the ASP script ... so check that the address is valid.

  • If you have a proxy server or firewall, make sure that the web server is configured correctly to go through it, that the SMTP server knows about it and that the proxy server allows access to port 25.

  • Try using SendUsing 1 (pickup) instead of 2 (port). For instance. next line:

     .Item(cdoSendUsingMethod) = cdoSendUsingPort 

Is becoming

 .Item(cdoSendUsingMethod) = cdoSendUsingPickup 

http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.html

+4
source

All Articles