?
Solved

Please help its urgent. cdo sendusing configuration value is invalid

Posted on 2004-10-04
13
Medium Priority
?
1,172 Views
Last Modified: 2008-03-17
Dim val1 As String, val3 As String, val4 As String, val5 As String
Dim email As String
Dim from_mail As String
Dim Mail_Body As String
Dim mmcdoconfig As Cdo.Configuration
Dim mgcdomsg As Cdo.Message
Dim an As New ADODB.Connection
Dim ar As New ADODB.Recordset
Dim hn As New ADODB.Recordset

Private Sub Send_Mail(from_mail As String)

Set mmcdoconfig = New Cdo.Configuration
Set mgcdomsg = New Cdo.Message
Set ar = an.Execute("select * from d4d.customer where type=1")
Set hn = an.Execute("select * from raj.htmls")
'mgcdomsg.DSNOptions = cdoDSNDefault
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CdoSendUsing.cdoSendUsingPort
mmcdoconfig.Fields("Smtpserver") = "smtp.hotpop.com"
mmcdoconfig.Fields("smtpserverport") = 25
mmcdoconfig.Fields("Username") = "userid@HotPOP.com"
mmcdoconfig.Fields("Password") = "passsword"
mmcdoconfig.Fields("SendemailAddress") = emailadress
mgcdomsg.Subject = subject
mgcdomsg.MimeFormatted = True

mmcdoconfig.Load (cdoIIS)
mgcdomsg.Configuration = mmcdoconfig
If Not hn.EOF Then
    mgcdomsg.HTMLBody = hn.Fields(1).Value 'html body from database
End If
'While Not ar.EOF
   ' mgcdomsg.Sender = ar.Fields(2)
    mgcdomsg.To = "emailadress"
    mgcdomsg.From = fromaddress
   
    mgcdomsg.Send
    Sleep (10)
'    ar.MoveNext
'Wend

Command1.Enabled = False

End Sub
Public Sub Sleep(ByVal duration As Integer)
  Dim x As Integer
  For x = 1 To duration * 1000
       DoEvents
  Next x
End Sub


when i run this code there is a runtime error 80040220 which says the "SendUsing configuration value is invalid.
i am using the remote smtp. i have uninstalled the local smtp  in my machine

0
Comment
Question by:raj_ms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 3
13 Comments
 
LVL 3

Accepted Solution

by:
rinksno1 earned 1500 total points
ID: 12216265
i did this and it worked....(using ASP)

<%
Const cdoSendUsingMethod        = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort          = 2
Const cdoSMTPServer             = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
      .Item(cdoSendUsingMethod)       = cdoSendUsingPort
      .Item(cdoSMTPServer)            = "smtp.mailserver.com"
      .Item(cdoSMTPServerPort)        = 25
      .Item(cdoSMTPConnectionTimeout) = 10
      .Item(cdoSMTPAuthenticate)      = cdoBasic
      .Item(cdoSendUserName)          = "abc"           'this is without @ symbol
      .Item(cdoSendPassword)          = "pass1"

      .Update
End With

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

Set objMessage.Configuration = objConfig

With objMessage
      .To       = "Display Name <email_address>"
      .From     = "Display Name <email_address>"
      .Subject  = "SMTP Relay Test"
      .TextBody = "SMTP Relay Test Sent @ " & Now()
      .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>

rinks
0
 

Author Comment

by:raj_ms
ID: 12216423
rinks,
it again uses local smtp, instead of my remote smtp.
i tried to uninstall smtp also.
0
 

Author Comment

by:raj_ms
ID: 12216652
even after uninstalling it uses my local smtp
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:raj_ms
ID: 12216779
Set objMessage.Configuration = objConfig
there is an error
it gave an error (0x8004020F) near this line
0
 

Author Comment

by:raj_ms
ID: 12217049
this error is by asp
0
 

Author Comment

by:raj_ms
ID: 12218578
Can you please help me sort out this error. its ok if it is asp also.
0
 

Author Comment

by:raj_ms
ID: 12235510
<html>
<head>
</head>
<body>
<%
Const cdoSendUsingMethod       = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort          = 2
Const cdoSMTPServer             = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set objMessage = Server.CreateObject("CDO.Message")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
     .Item(cdoSendUsingMethod)       = cdoSendUsingPort
     .Item(cdoSMTPServer)            = "smtp.hotpop.com"
     .Item(cdoSMTPServerPort)        = 25
     .Item(cdoSMTPConnectionTimeout) = 60
     .Item(cdoSMTPAuthenticate)      = cdoBasic
     .Item(cdoSendUserName)          = "raj_itengg@HotPop.com"          
     .Item(cdoSendPassword)          = "abcdef1"

     .Update
End With

Set objMessage.Configuration = objConfig

With objMessage
     .mimeformatted=true
     .To       = "emailid"
     .From     = "senderaddress"
     .Subject  = "SMTP "
     .HtmlBody = "<html><head></head><body>SMTP Relay Test Sent @ " & Now() & "</body></html>"
     .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>

</body>
</html>

this gives error as below


HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
(0x8004020F)
/remotesmtpmail.asp, line 46


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)

Page:
POST 13 bytes to /remotesmtpmail.asp
0
 

Author Comment

by:raj_ms
ID: 12235523
Now mails are not going since i switched off the local smtp and giving the error.

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
(0x8004020F)
/remotesmtpmail.asp, line 46


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)

Page:
POST 13 bytes to /remotesmtpmail.asp

even if i switch on the local smtp, it porduces the same error.
0
 

Author Comment

by:raj_ms
ID: 12235550
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY><PRE><%
Const cdoBasic = 1 'Use basic (clear-text) authentication.
Const cdoSendUsingPort = 2

Dim iMsg
Dim iConf
Dim Flds

On Error Resume Next

'Create message and configuration objects
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

'Appluy settings to the configuration object
With Flds
      ' Specify the authentication mechanism to basic (clear-text) authentication.
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
      ' The username for authenticating to an SMTP server
'      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MAIL_SMTP_USERNAME"

      ' The password used to authenticate to an SMTP server
'      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MAIL_SMTP_PASSWORD"

      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort

      'Specify mail server
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.10.1.23 "'"MAIL_SMTP_SERVER"

      'Specify the timeout in seconds
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = "30"

      ' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      
      'Use SSL for the connection (False or True)
      '.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

      .Update
End With

Dim sMsg
Dim sTo
Dim sCC
Dim sFrom
Dim sSubject
Dim sTextBody

sTo = "someid@hotmail.com"

sFrom = "someid@hotmail.com"
sSubject = "Insert here your subject text"
sTextBody = "Insert here your plain body text"

'Apply the settings to the message object
With iMsg
      Set .Configuration = iConf
        .mimeformatted=false
      .To = sTo
      .From = sFrom
      
      .Subject = sSubject
      .TextBody = sTextBody
      
      'Send message
      .Send
      
End With

      if err.number=0 then
            response.write "Mails Sent"
      end if
' cleanup mail objects
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

%></PRE></BODY></HTML>


this code doesnot give any errors, but mails are not going

My smtp server is a lotus domino and have top level domin as uk and sub domain as co
0
 

Author Comment

by:raj_ms
ID: 12235719
<html>
<head>
</head>
<body>
<%
Const cdoSendUsingMethod       = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort          = 2
Const cdoSMTPServer             = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set objMessage = Server.CreateObject("CDO.Message")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
     .Item(cdoSendUsingMethod)       = cdoSendUsingPort
     .Item(cdoSMTPServer)            = "10.10.1.23" '"smtp.hotpop.com"
     .Item(cdoSMTPServerPort)        = 25
     .Item(cdoSMTPConnectionTimeout) = 60
     .Item(cdoSMTPAuthenticate)      = cdoBasic
 '    .Item(cdoSendUserName)          = "raj_itengg@HotPop.com"          
 '    .Item(cdoSendPassword)          = "abcdef1"

     .Update
End With

'Set objMessage.Configuration = objConfig

With objMessage
     .mimeformatted=true
     .To       = "address@hotmail.com"
     .From     = "address"
     .Subject  = "SMTP "
     .HtmlBody = "<html><head></head><body>SMTP Relay Test Sent @ " & Now() & "</body></html>"
     .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>

</body>
</html>

this code is one that gave me an error. but the error is rectified by commenting a statement
'Set objMessage.Configuration = objConfig
but the problem still exists. mails are not moving from pickup folder, i am not using local smtp.
0
 
LVL 3

Expert Comment

by:rinksno1
ID: 12236150
have you tried asp email this can be used to relay from a defined smtp server....

www.aspemail.com

rinks
0
 
LVL 3

Expert Comment

by:rinksno1
ID: 12236161
in case you are under firewall/proxy if yes you might need some settings at the proxy server also....

rinks
0
 

Author Comment

by:raj_ms
ID: 12236174
i got it myself but its with an intuition and ur help instead of const i used "http://schemas.microsoft.com/cdo/configuration/" so it worked


Set mmcdoconfig = New Cdo.Configuration
Set mgcdomsg = New Cdo.Message
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'CdoSendUsing.cdoSendUsingPort
'mgcdomsg.DSNOptions = cdoDSNDefault
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "jeeves"   '"smtp.hotpop.com"
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'mmcdoconfig.Fields("smtpauthenticate") = cdoBasic
'mmcdoconfig.Fields("sendusername") = "dajkaj"
'mmcdoconfig.Fields("sendpassword") = "password"
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = adrdes
mmcdoconfig.Fields.Update
mgcdomsg.Subject = val5
mgcdomsg.MimeFormatted = True

mmcdoconfig.Load (cdoIIS)
Set mgcdomsg.Configuration = mmcdoconfig
    mgcdomsg.HTMLBody = "<html<head></head><body>hello</body></html>" 'hn.Fields(1).Value
    mgcdomsg.To = "raj_itengg@hotmail.com" '"arumugaraja.mohan@unitednetworks.co.uk"
    mgcdomsg.From = val3 '"Dial4discount<info@dial4discount.com>" 'val5
   
    mgcdomsg.Send
    Sleep (10)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question