raj_ms
asked on
Please help its urgent. cdo sendusing configuration value is invalid
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.cdoSendUsingP ort
mmcdoconfig.Fields("Smtpse rver") = "smtp.hotpop.com"
mmcdoconfig.Fields("smtpse rverport") = 25
mmcdoconfig.Fields("Userna me") = "userid@HotPOP.com"
mmcdoconfig.Fields("Passwo rd") = "passsword"
mmcdoconfig.Fields("Sendem ailAddress ") = 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
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.cdoSendUsingP
mmcdoconfig.Fields("Smtpse
mmcdoconfig.Fields("smtpse
mmcdoconfig.Fields("Userna
mmcdoconfig.Fields("Passwo
mmcdoconfig.Fields("Sendem
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
even after uninstalling it uses my local smtp
ASKER
Set objMessage.Configuration = objConfig
there is an error
it gave an error (0x8004020F) near this line
there is an error
it gave an error (0x8004020F) near this line
ASKER
this error is by asp
ASKER
Can you please help me sort out this error. its ok if it is asp also.
ASKER
<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.C onfigurati on")
Set objMessage = Server.CreateObject("CDO.M essage")
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.hotpop.com"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTim eout) = 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
<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.C
Set objMessage = Server.CreateObject("CDO.M
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.hotpop.com"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTim
.Item(cdoSMTPAuthenticate)
.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>
.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
ASKER
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.
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.
ASKER
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HE AD>
<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.Configur ation")
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
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HE
<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.Configur
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
ASKER
<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.C onfigurati on")
Set objMessage = Server.CreateObject("CDO.M essage")
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(cdoSMTPConnectionTim eout) = 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.
<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.C
Set objMessage = Server.CreateObject("CDO.M
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(cdoSMTPConnectionTim
.Item(cdoSMTPAuthenticate)
' .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>
.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.
have you tried asp email this can be used to relay from a defined smtp server....
www.aspemail.com
rinks
www.aspemail.com
rinks
in case you are under firewall/proxy if yes you might need some settings at the proxy server also....
rinks
rinks
ASKER
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.cdoSendUsing Port
'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("smtpa uthenticat e") = cdoBasic
'mmcdoconfig.Fields("sendu sername") = "dajkaj"
'mmcdoconfig.Fields("sendp assword") = "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>h ello</body ></html>" 'hn.Fields(1).Value
mgcdomsg.To = "raj_itengg@hotmail.com" '"arumugaraja.mohan@united networks.c o.uk"
mgcdomsg.From = val3 '"Dial4discount<info@dial4 discount.c om>" 'val5
mgcdomsg.Send
Sleep (10)
Set mmcdoconfig = New Cdo.Configuration
Set mgcdomsg = New Cdo.Message
mmcdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'CdoSendUsing.cdoSendUsing
'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("smtpa
'mmcdoconfig.Fields("sendu
'mmcdoconfig.Fields("sendp
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>h
mgcdomsg.To = "raj_itengg@hotmail.com" '"arumugaraja.mohan@united
mgcdomsg.From = val3 '"Dial4discount<info@dial4
mgcdomsg.Send
Sleep (10)
ASKER
it again uses local smtp, instead of my remote smtp.
i tried to uninstall smtp also.