Oh and ignore the lines
part = 0
While part < totalparts
Wend
That was some testing stuff but isnt sposed to be there.
Main Topics
Browse All TopicsI 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
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
.Item(cdoSMTPAuthenticate)
.Item(cdoSendUserName) = SMTP_USER
.Item(cdoSendPassword) = SMTP_PASSWORD
.Update
End With
Set objMessage = Server.CreateObject("CDO.M
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.
cdoSendUsingPort = 2
cdoSMTPServer = "http://schemas.microsoft.
cdoSMTPServerPort = "http://schemas.microsoft.
cdoSMTPConnectionTimeout = "http://schemas.microsoft.
cdoSMTPAuthenticate = "http://schemas.microsoft.
cdoBasic = 1
cdoSendUserName = "http://schemas.microsoft.
cdoSendPassword = "http://schemas.microsoft.
End Sub
Private Function GetAddresses()
Dim arrResult
Dim FSO, FileHandle
Dim sFilePath
Dim sLine, sFileContent
sFilePath = Request.ServerVariables("A
' Open the file
Set FSO = Server.CreateObject("Scrip
If FSO.FileExists(sFilePath) Then
Set FileHandle = FSO.OpenTextFile(sFilePath
' Read a line
sLine = Trim(FileHandle.readLine)
sFileContent = sLine
' Read until we reach the end of the file
While Not(FileHandle.atEndOfStre
' 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-
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This is not really a CDO limit but an SMTP limit (RFC limit actually). The body of the message probably contains bare line feeds. What that means is any time a new line is requested, the body only contains the Line Feed character. SMTP expects a Carriage Return-Line Feed, not just Line Feed. Without this the text never wraps and overruns the buffer allowed by SMTP. You could load p_sContent into a variable, parse the variable replacing chr(10) with chr(13) & chr(10). This should correct any bare line feeds, and now you can just set .HTMLBody to the variable.
from http://www.ietf.org/rfc/rf
> text line
>
> The maximum total length of a text line including the
> <CRLF> is 1000 characters (but not counting the leading
> dot duplicated for transparency).
marc_nivens' suggestion should take care of most emails. however if you have sections of text such as a long text field from a db, that could exceed the 1000 character limit without any cr or lf in between. you would need to insert a vbcrlf every 1000 characters.
Business Accounts
Answer for Membership
by: alorentzPosted on 2005-10-05 at 12:31:52ID: 15024882
>>is there a maximum message size and what can I do to make it send large messages.
Not really...
The limits are set up in SMTP on the server. You can set to whatever you want.