cdo.message

H

Hugh Welford

Hi Using WIN XP and FP2000

Using CDO.message to out put a message from my site, I get the following
error message 8004020f from using the code:-

strsql = "SELECT * FROM details WHERE patid = " & request("to") & ";"
objrec.open strsql, objconn, adopenforwardonly, adlockoptimistic, adcmdtext

thetext = "Hello, " & request("nickto") & " you have a new message on online
Connect from " & session("username") & "<br> <a target='_top'
href='http://www.onlineconnect.biz/daters'><big><em><strong>Click here to
log
into the site</strong></em></big></a> then check your messages.<br> Good
luck"

Set cdoConfig = Server.CreateObject("CDO.Configuration")
With cdoConfig.Fields
..Item(cdoSendUsingMethod) = cdoSendUsingPort
..Item(cdoSMTPServer) = "pegasus.intonet.co.uk"
..Update
End With
Set cdoMessage = Server.CreateObject("CDO.Message")
With cdoMessage
Set.Configuration = cdoConfig
..From = "(e-mail address removed)"
..To = objrec("emailaddress")
..cc = "(e-mail address removed)"
..Subject = "New messgage from Online Connect"
..HTMLBody = thetext
..Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing

any ideas?? thanks in advance Hugh
 
S

Slim

there is something at aspfaq.com I have posted further down, but first I
would try this code directly below. (its in VB, you need to make
adjustments).

it seems to work from behind firewalls and the like, more info here
http://msdn.microsoft.com/library/d.../cdosys/html/_cdosys_schema_configuration.asp



Dim iMsg As CDO.Message
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 1
Const strPickup = "c:\inetpub\mailroot\pickup"

Private Sub createMailObject()


'Create the message object.
Set iMsg = CreateObject("CDO.Message")

'Create the configuration object.
Set iConf = iMsg.Configuration

With iConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPickup

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirect
ory") = strPickup
.Update
End With

End Sub




Sub sendHTML(cdoTo As String, cdoFRom As String, cdoSubject As String,
cdoHTML As String, Optional cdoAttch As Variant = "")
createMailObject


With iMsg
If IsArray(cdoAttch) Then
For Each thing In cdoAttch
.AddAttachment (thing)
Next
End If
.To = cdoTo
.From = cdoFRom
.Subject = cdoSubject
.HTMLBody = cdoHTML
.Send
End With
Set iMsg = Nothing
End Sub


Sub sendText(cdoTo As String, cdoFRom As String, cdoSubject As String,
cdoText As String, Optional cdoAttch As Variant = "")
createMailObject
With iMsg
If IsArray(cdoAttch) Then
For Each thing In cdoAttch
.AddAttachment (thing)
Next
End If
.To = cdoTo
.From = cdoFRom
.Subject = cdoSubject
.TextBody = cdoText
.Send
End With
Set iMsg = Nothing
End Sub


Sub sendWebPage(cdoTo As String, cdoFRom As String, cdoSubject As String,
cdoPage As String, Optional cdoAttch As Variant = "")
createMailObject
With iMsg
With iMsg
If IsArray(cdoAttch) Then
For Each thing In cdoAttch
.AddAttachment (thing)
Next
End If
.To = cdoTo
.From = cdoFRom
.Subject = cdoSubject
.CreateMHTMLBody cdoPage
.Send
.HTMLBody = ""
End With
End With
Set iMsg = Nothing
End Sub


Private Sub Class_Terminate()
Set iMsg = Nothing
End Sub














Why does CDO.Message give me an 8004020f error?

492 requests - last updated Thursday, June 27, 2002

When switching from CDONTS to CDO.Message, when using code like the
following (as described in Article #2026):

<%

sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = Server.CreateObject("CDO.Configuration")

cdoConfig.Fields.Item(sch & "sendusing") = 2

cdoConfig.Fields.Item(sch & "smtpserver") = "<enter_mail.server_here>"

cdoConfig.fields.update

Set cdoMessage = Server.CreateObject("CDO.Message")

Set cdoMessage.Configuration = cdoConfig

cdoMessage.From = "(e-mail address removed)"

cdoMessage.To = "(e-mail address removed)"

cdoMessage.Subject = "Sample CDONTS NewMail"

cdoMessage.TextBody = "This is a test for CDONTS message"

cdoMessage.Send

Set cdoMessage = Nothing

Set cdoConfig = Nothing

%>

You might come across the following error:

error '8004020f'

The event class for this subscription is in an invalid partition

/<file>.asp, line <line>

It is not clear where this error message comes from; it's not even in
Microsoft's Knowledge Base or MSDN Library.

However here are some things you can try to alleviate the problem:

1. Make sure the SMTP server allows anonymous (non-authenticated) relaying.
Otherwise, you'll have to use a

mail component that supports SMTP authentication, like ASPEmail.

2. Check if the problem is specific to the domain name(s) used in the e-mail
addresses of the recipients. For

example, some users have complained that they can send to users on their own
domain only; others have

said that they can send to any domain except their own.

3. If you have a proxy or firewall, make sure the web server is set up to
correctly pass through it, that the

SMTP server knows about it, and that the proxy allows access to port 25.

4. Try using a SendUsing value of 1 (pickup) instead of 2 (port). E.g. the
following line:

cdoConfig.Fields.Item(sch & "sendusing") = 2

Becomes

cdoConfig.Fields.Item(sch & "sendusing") = 1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

CDO.message 4
CDO.Message 6
cdo message attachments 0
Error in loading DLL: 'cdoConfig.Fields' 1
CDO.MESSAGE 1
asp send mail cdo error 1
CDO generating duplicate e-mails 0
Read receipt with CDO 2000 2

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top