• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

CDO errors

W

wasim676

Guest
Dear Sir,

Hi,
I am using CDO, it works fine but when I attache some file and send mail then there is following error.

CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/American/ozdare/testcdo.asp, line 29



I am using the follwing code,

<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->


<%
RESPONSE.Buffer=TRUE

'IF Session("user_id")="" AND Request.QueryString(key) then Response.Redirect("sign.asp?SessionExp=true")

%>
<%

Function SendEmail(mailto,mailfrom,mailsubject,message,cc,bcc)


'On Error Resume Next
Dim objCDO
Dim iConf
Dim Flds
'cdoSendUsingPort = 2


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


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


Set Flds = iConf.Fields


With Flds
'.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "smtp.mydomain.com"
.Item(cdoSMTPServerPort) = 25

.Update
End With


Set objCDO.Configuration = iConf

objCDO.From = mailfrom
objCDO.To = mailto
objCDO.Subject = mailsubject
'objCDO.TextBody = message
objCDO.CC=cc
objCDO.BCC=bcc
objCDO.HTMLBody=message

objCDO.Send


Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
'Response.Write("Error="&err.description)

End Function

Function SendEmailText(mailto,mailfrom,mailsubject,message,cc,bcc)
' Response.Write("3.1")

'On Error Resume Next
Dim objCDO
Dim iConf
Dim Flds
'cdoSendUsingPort = 2

' Response.Write("3.2")
Set objCDO = Server.CreateObject("CDO.Message")


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


Set Flds = iConf.Fields
' Response.Write("3.3")

With Flds
'.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
' this is the server SMTP address
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
' this is the SMTP PORT
.Item(cdoSMTPServerPort) = 25

.Update
End With


Set objCDO.Configuration = iConf

objCDO.From = mailfrom
objCDO.To = mailto
objCDO.Subject = mailsubject
objCDO.CC=cc
objCDO.BCC=bcc
objCDO.TextBody=message

objCDO.Send

if err.number <> 0 Then
response.Write(err.description)
end if
'Response.Write("Mail Sent")
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
'Response.Write("Error="&err.description)

End Function


Function SendEmailAtt(mailto,mailfrom,mailsubject,message,cc,bcc,AttFilePath)


'On Error Resume Next
Dim objCDO
Dim iConf
Dim Flds
'cdoSendUsingPort = 2


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


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


Set Flds = iConf.Fields


With Flds
'.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "mail-fwd"
.Item(cdoSMTPServerPort) = 25

.Update
End With


Set objCDO.Configuration = iConf

objCDO.From = mailfrom
objCDO.To = mailto
objCDO.Subject = mailsubject
'objCDO.TextBody = message
objCDO.CC=cc
objCDO.BCC=bcc
objCDO.HTMLBody=message
if AttFilePath<>"" then
objCDO.AddAttachment(AttFilePath)
end if
objCDO.Send

Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
'Response.Write("Error="&err.description)

End Function
%>
Please! Resolve my issue.
Thanks in advance.

Best Regards,
Wasim.
 
Back
Top