I try to send an email by using CDOSYS with this code
-----------
Class EmailSender
Private EMAIL_LIST_FILE
Private cdoSendUsingMethod
Private cdoSendUsingPort
Private cdoSMTPServer
Private cdoSMTPServerPort
Private cdoSMTPConnectionTimeout
Private cdoSMTPAuthenticate
Private cdoBasic
Private cdoSendUserName
Private cdoSendPassword
Public Sub SendMail(p_sContent)
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields
Dim arrAddresses
Dim n
arrAddresses = GetAddresses()
If IsArray(arrAddresses) Then
' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.C
onfigurati
on")
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = SMTP_SERVER
.Item(cdoSMTPServerPort) = SMTP_PORT
.Item(cdoSMTPConnectionTim
eout) = 60
.Item(cdoSMTPAuthenticate)
= cdoBasic
.Item(cdoSendUserName) = SMTP_USER
.Item(cdoSendPassword) = SMTP_PASSWORD
.Update
End With
Set objMessage = Server.CreateObject("CDO.M
essage")
Set objMessage.Configuration = objConfig
For n = 0 To UBound(arrAddresses)
part = 0
While part < totalparts
With objMessage
.To = arrAddresses(n)
.From = "(DO NOT REPLY) <noreply@somewhere.com>"
.Subject = "Order Confirmation"
.HTMLBody = p_sContent
.Send '<---- LINE 55
End With
Wend
Next
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
End If
End Sub
Private Sub Class_Initialize()
EMAIL_LIST_FILE = "email.txt"
cdoSendUsingMethod = "
http://schemas.microsoft.com/cdo/configuration/sendusing"
cdoSendUsingPort = 2
cdoSMTPServer = "
http://schemas.microsoft.com/cdo/configuration/smtpserver"
cdoSMTPServerPort = "
http://schemas.microsoft.com/cdo/configuration/smtpserverport"
cdoSMTPConnectionTimeout = "
http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
cdoSMTPAuthenticate = "
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
cdoBasic = 1
cdoSendUserName = "
http://schemas.microsoft.com/cdo/configuration/sendusername"
cdoSendPassword = "
http://schemas.microsoft.com/cdo/configuration/sendpassword"
End Sub
Private Function GetAddresses()
Dim arrResult
Dim FSO, FileHandle
Dim sFilePath
Dim sLine, sFileContent
sFilePath = Request.ServerVariables("A
PPL_PHYSIC
AL_PATH") & EMAIL_LIST_FILE
' Open the file
Set FSO = Server.CreateObject("Scrip
ting.FileS
ystemObjec
t")
If FSO.FileExists(sFilePath) Then
Set FileHandle = FSO.OpenTextFile(sFilePath
, 1, false, 0)
' Read a line
sLine = Trim(FileHandle.readLine)
sFileContent = sLine
' Read until we reach the end of the file
While Not(FileHandle.atEndOfStre
am)
' read another line
sLine = Trim(FileHandle.readLine)
sFileContent = sFileContent & "," & sLine
Wend
' Split the addresses into an array
If Len(sFileContent) > 0 Then
arrResult = Split(sFileContent, ",")
End If
Else
Response.Write("Email file not found: " & EMAIL_LIST_FILE)
End If
' Return the array
GetAddresses = arrResult
End Function
End Class
---------------
The body is a html file that is generated in another script. The sending works fine most of the times but as soon as the body gets over a certain size (I think its around 10KB) the following error message is displayed:
error '80040211'
/include/Email.asp, line 55
Line 55 is the line with .Send
-------------
So my question is, is there a maximum message size and what can I do to make it send large messages.
-TCM-